我尝试将蓝牙低功耗 (BLE) 键盘(由 Nice!nano MCU 供电)连接到 Arch Linux 设备。最初,键盘根本没有显示为蓝牙设备,但运行后检测到hcitool lescan
。然后我尝试通过以下方式连接到它bluetoothctl
:
Agent registered
[CHG] Controller 9C:B6:D0:E4:52:C8 Pairable: yes
[bluetooth]# agent KeyboardOnly
Agent is already registered
[bluetooth]# default-agent
Default agent request successful
[bluetooth]# power on
Changing power on succeeded
[bluetooth]# scan on
Discovery started
[NEW] Device C9:08:85:1C:61:35 Cradio
[bluetooth]# pair C9:08:85:1C:61:35
Attempting to pair with C9:08:85:1C:61:35
Failed to pair: org.bluez.Error.AuthenticationRejected
[bluetooth]# info C9:08:85:1C:61:35
Device C9:08:85:1C:61:35 (random)
Name: Cradio
Alias: Cradio
Appearance: 0x03c1
Icon: input-keyboard
Paired: no
Trusted: yes
Blocked: no
Connected: no
LegacyPairing: no
UUID: Human Interface Device (00001812-0000-1000-8000-00805f9b34fb)
UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
AdvertisingFlags:
06 .
[bluetooth]# trust C9:08:85:1C:61:35
Changing C9:08:85:1C:61:35 trust succeeded
[bluetooth]# pair C9:08:85:1C:61:35
Attempting to pair with C9:08:85:1C:61:35
Failed to pair: org.bluez.Error.AuthenticationRejected
[bluetooth]# connect C9:08:85:1C:61:35
Attempting to connect to C9:08:85:1C:61:35
Failed to connect: org.bluez.Error.Failed Input/output error
btmon
显示以下输出:
@ MGMT Command: Pair Device (0x0019) plen 8 {0x0001} [hci0] 3.201866
LE Address: C9:08:85:1C:61:35 (Static)
Capability: KeyboardDisplay (0x04)
@ MGMT Event: Command Complete (0x0001) plen 10 {0x0001} [hci0] 3.201888
Pair Device (0x0019) plen 7
Status: Rejected (0x0b)
LE Address: C9:08:85:1C:61:35 (Static)
= bluetoothd: src/device.c:device_connect_le() ATT bt_io_connect(C9:08:85:.. 6.293285
journalctl
输出bluetoothd
(-d
启用调试):
Aug 15 17:26:28 xps15 bluetoothd[9301]: src/device.c:btd_device_set_temporary() temporary 0
Aug 15 17:26:28 xps15 bluetoothd[9301]: src/agent.c:agent_ref() 0x557957793970: ref=2
Aug 15 17:26:28 xps15 bluetoothd[9301]: src/device.c:bonding_request_new() Requesting bonding for C9:08:85:1C:61:35
Aug 15 17:26:28 xps15 bluetoothd[9301]: src/agent.c:agent_ref() 0x557957793970: ref=3
Aug 15 17:26:28 xps15 bluetoothd[9301]: src/agent.c:agent_unref() 0x557957793970: ref=2
Aug 15 17:26:28 xps15 bluetoothd[9301]: src/adapter.c:suspend_discovery()
Aug 15 17:26:28 xps15 bluetoothd[9301]: src/adapter.c:adapter_bonding_attempt() hci0 bdaddr C9:08:85:1C:61:35 type 2 io_cap 0x04
Aug 15 17:26:28 xps15 bluetoothd[9301]: src/adapter.c:pair_device_complete() Rejected (0x0b)
Aug 15 17:26:28 xps15 bluetoothd[9301]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr C9:08:85:1C:61:35 type 2 status 0xb
Aug 15 17:26:28 xps15 bluetoothd[9301]: src/device.c:device_bonding_complete() bonding 0x5579577a4ca0 status 0x0b
Aug 15 17:26:28 xps15 bluetoothd[9301]: src/device.c:btd_device_set_temporary() temporary 1
Aug 15 17:26:28 xps15 bluetoothd[9301]: src/device.c:device_bonding_failed() status 11
Aug 15 17:26:28 xps15 bluetoothd[9301]: src/agent.c:agent_unref() 0x557957793970: ref=1
Aug 15 17:26:28 xps15 bluetoothd[9301]: src/adapter.c:resume_discovery()
Aug 15 17:26:28 xps15 bluetoothd[9301]: src/adapter.c:trigger_start_discovery()
答案1
我能够通过将ControllerMode
属性更改为dual
in来解决此问题/etc/bluetooth/main.conf
。这是bredr
默认的。
# Restricts all controllers to the specified transport. Default value
# is "dual", i.e. both BR/EDR and LE enabled (when supported by the HW).
# Possible values: "dual", "bredr", "le"
ControllerMode = dual
然后设备被检测到bluetoothctl
并连接,没有任何问题。