树莓派蓝牙相关问题
因系统更新快,这里的操作仅供参考!!
- 升级安装蓝牙相关软件包
# sudo apt-get install pi-bluetooth bluez bluez-firmware blueman
- 添加pi用户到蓝牙组
# sudo usermod -G bluetooth -a pi
- 重启
# sudo reboot
- 使用命令打开蓝牙
pi@raspberrypi:/ $ sudo bluetoothctl
[bluetooth]#list
Controller B8:27:EB:3D:15:E9 raspberrypi [default]
[bluetooth]# scan on
Discovery started
[CHG] Device 5F:FC:4E:B0:EA:59 RSSI: -97
[NEW] Device 42:29:9A:3B:75:E6 42-29-9A-3B-75-E6
[bluetooth]# devices
Device 30:21:4F:54:4D:8E Newmine
Device 72:D7:02:62:CE:A0 72-D7-02-62-CE-A0
Device 5F:FC:4E:B0:EA:59 5F-FC-4E-B0-EA-59
Device E4:A7:C5:C8:55:F5 HUAWEI Mate 10 Pro
Device 42:29:9A:3B:75:E6 42-29-9A-3B-75-E6
[bluetooth]# pair 30:21:4F:54:4D:8E
Attempting to pair with 30:21:4F:54:4D:8E
Failed to pair: org.bluez.Error.AlreadyExists(已配对成功过,如果是初次配对是显示成功的信息)
[bluetooth]# trust 30:21:4F:54:4D:8E
Changing 30:21:4F:54:4D:8E trust succeeded
[bluetooth]# connect 30:21:4F:54:4D:8E
Attempting to connect to 30:21:4F:54:4D:8E
[CHG] Device 30:21:4F:54:4D:8E Connected: yes
Connection successful
[CHG] Device 5F:FC:4E:B0:EA:59 RSSI: -86
[CHG] Device 30:21:4F:54:4D:8E ServicesResolved: yes
[Newmine]#quit