LAKKA 树莓派连接蓝牙手柄
下面是在一个 8Bitdo NES30 Pro 手柄上测试的其他蓝牙手柄应该也可以.
8Bitdo 蓝牙手柄不会自动配对. 因此必须利用ssh进行命令控制进行配对。
打开蓝牙
再Services里面找到蓝牙选项,并打开。
下面要用ssh进行控制
打开终端(mac,linux;windows请度娘)
sudo ssh root@树莓派ip地址
如果秘钥出问题
sudo rm -rf /var/root/.ssh/known_hosts
然后再连接
检查蓝牙服务状态
systemctl status bluetooth
应该能够看到下面的信息
Mar 08 02:28:49 Lakka systemd[1]: Started Bluetooth service.
Mar 08 02:28:49 Lakka bluetoothd[522]: Bluetooth daemon 5.43
Mar 08 02:28:49 Lakka bluetoothd[522]: Starting SDP server
Mar 08 02:28:49 Lakka bluetoothd[522]: kernel lacks bnep-protocol support
Mar 08 02:28:49 Lakka bluetoothd[522]: System does not support network plugin
Mar 08 02:28:49 Lakka bluetoothd[522]: Bluetooth management interface 1.14 initialized
Mar 08 02:28:49 Lakka bluetoothd[522]: Failed to obtain handles for "Service Changed" characteristic
Mar 08 02:28:49 Lakka bluetoothd[522]: Failed to set privacy: Rejected (0x0b)
Mar 08 02:32:54 Lakka bluetoothd[522]: No agent available for request type 0
Mar 08 02:32:54 Lakka bluetoothd[522]: device_request_pin: Operation not permitted
如果出现下面信息:
● bluetooth.service - Bluetooth service
Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
Active: inactive (dead)
Condition: start condition failed at Tue 2015-04-07 19:35:48 UTC; 1min 59s ago
ConditionPathExists=/storage/.cache/services/bluez.conf was not met
尝试手动开启蓝牙服务
systemctl enable bluetooth
systemctl start bluetooth
再检查蓝牙状态重复上面的步骤
如果蓝牙还是报错,请创建配置文件并重启蓝牙服务
touch /storage/.cache/services/bluez.conf
systemctl start bluetooth
配对蓝牙
运行蓝牙控制模块
bluetoothctl
一个蓝牙提示符[bluetooth]#将会出现,输入下面的命令
agent on
default-agent
power on
discoverable on
pairable on
scan on
打开你的8Bitdo 控制器模式1. 将会显示下面的信息
Discovery started
[CHG] Controller B8:27:EB:48:30:22 Discovering: yes
[NEW] Device E4:17:D8:3E:6A:7D 8Bitdo NES30 Pro
连接手柄,输入下面的命令
connect <device_addr>
将会显示下面的信息
[bluetooth]# connect E4:17:D8:3E:6A:7D
Attempting to connect to E4:17:D8:3E:6A:7D
[CHG] Device E4:17:D8:3E:6A:7D Connected: yes
[CHG] Device E4:17:D8:3E:6A:7D Modalias: usb:v3820p0009d0100
[CHG] Device E4:17:D8:3E:6A:7D UUIDs: 00001124-0000-1000-8000-00805f9b34fb
[CHG] Device E4:17:D8:3E:6A:7D UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device E4:17:D8:3E:6A:7D Paired: yes
Connection successful
信任设备
trust <device_addr>
完工。
测试再重启开机后手柄会自动连接。如果失去连接请重启手柄和树莓派。再不行就重新连接。
connect <device_addr>