检测蓝牙模块/启动蓝牙
查看硬件设备
shelllspci | grep Bluetooth
lspci | grep Bluetooth
查看usb设备
lsusb | grep Bluetooth
lsusb | grep Bluetooth
查看蓝牙状态
shell# 查看蓝牙状态 systemctl status bluetooth # 如果该命令输出显示 disabled 说明服务未启动 # 查看设备是否启动 hciconfig # 如果该命令输出中有 DOWN 字样则说明设备未启动
# 查看蓝牙状态 systemctl status bluetooth # 如果该命令输出显示 disabled 说明服务未启动 # 查看设备是否启动 hciconfig # 如果该命令输出中有 DOWN 字样则说明设备未启动
启动蓝牙设备和服务
shell#启动蓝牙硬件 hciconfig hci0 up #启动蓝牙服务 sudo systemctl start bluetooth
#启动蓝牙硬件 hciconfig hci0 up #启动蓝牙服务 sudo systemctl start bluetooth
连接蓝牙
启动蓝牙管理工具
shellbluetoothctl
bluetoothctl
扫描设备
shell# 开始扫描 scan on #列出所有diveces devices
# 开始扫描 scan on #列出所有diveces devices
连接蓝牙设备
shell# MAC_ADDRESS 是上面扫描到的设备的mac地址,根据名字判断你需要连接的设备,然后进行蓝牙配对 pair MAC_ADDRESS trust MAC_ADDRESS connect MAC_ADDRESS
# MAC_ADDRESS 是上面扫描到的设备的mac地址,根据名字判断你需要连接的设备,然后进行蓝牙配对 pair MAC_ADDRESS trust MAC_ADDRESS connect MAC_ADDRESS
完成这一系列的命令,将蓝牙设备配对、信任并连接
验证设备状态
shellinfo MAC_ADDRESS
info MAC_ADDRESS