BLE(Bluetooth Low Energy)キーボード(Nice!nano MCUで駆動)をArch Linuxデバイスに接続しようとしています。最初はキーボードがBluetoothデバイスとしてまったく表示されていませんが、実行後に検出されました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
問題なく接続されました。