bkekelic
bkekelic

Reputation: 87

Cannot pair Bluetooth device: Authentication problem

I'm trying to pair and eventually connect to the Bluetooth device using bluetoothctl, but unfortunately pairing always fails. Device which initiates pairing (DeviceA) shows pin code and yes/no option to confirm, but other device (DeviceB) doesn't. And whatever I do, the connection goes to timeout and eventually fails.

< HCI Command: IO Capability Request Reply (0x01|0x002b) plen 9                 #21 [hci0] 10.668077
        Address: 58:63:9A:0B:75:28 (OUI 58-63-9A)
        IO capability: DisplayYesNo (0x01)
        OOB data: Authentication data not present (0x00)
        Authentication: Dedicated Bonding - MITM required (0x03)
> HCI Event: Command Complete (0x0e) plen 10                                    #22 [hci0] 10.668776
      IO Capability Request Reply (0x01|0x002b) ncmd 1
        Status: Success (0x00)
        Address: 58:63:9A:0B:75:28 (OUI 58-63-9A)
> HCI Event: IO Capability Response (0x32) plen 9                               #23 [hci0] 10.714623
        Address: 58:63:9A:0B:75:28 (OUI 58-63-9A)
        IO capability: DisplayYesNo (0x01)
        OOB data: Authentication data not present (0x00)
        Authentication: General Bonding - MITM not required (0x04)
> HCI Event: User Confirmation Request (0x33) plen 10                           #24 [hci0] 10.936580
        Address: 58:63:9A:0B:75:28 (OUI 58-63-9A)
        Passkey: 377842

check full logs here.

It is also surprising that it never works even if I try other IO capabilities. The only parameter I cannot match ever is Dedicated vs General bonding. Is there any way that I can maybe force the same type of Auth as it seems that this could be the cause of the issues.

Setup info:

[  544.819149] rsi_91x: <==== Interface DOWN ====>
[  544.828699] phone0: port 1(wlan0) entered disabled state
[  544.863028] device wlan0 left promiscuous mode
[  544.863067] phone0: port 1(wlan0) entered disabled state
[  545.113488] rsi_91x: ***** Watch Dog Reset Successful *****
[  546.324264] rsi_91x: rsi_reset_card: Set high speed mode
[  546.336188] rsi_91x: ##### RSI SDIO device disconnected #####
[  546.470461] rsi_91x: rsi_probe: ***** 9116 Module *****
[  546.470807] rsi_91x: rsi_hal_device_init: oper_mode = 4, coex_mode = 2
[  546.475523] rsi_91x: ================================================
[  546.475553] rsi_91x: ================ RSI Version Info ==============
[  546.475570] rsi_91x: ================================================
[  546.475591] rsi_91x: FW Version  :  1610.2.3.0.0001
[  546.475610] rsi_91x: Driver Version  : RS9116.NB0.NL.GNU.LNX.OSD.2.0.0.0024
[  546.475627] rsi_91x: Operating mode  : 4 [BT EDR alone]
[  546.475643] rsi_91x: Firmware file   : pmemdata_wlan_bt_classic
[  546.475653] rsi_91x: ================================================
[  546.571490] rsi_91x: ***** Firmware Loading successful *****

I'm not an expert in kernel configuration, so maybe there is something wrong with it.

Steps I do:

  1. Run bluetooth daemon in separate terminal with bluetoothd -n.
  2. Run bluetoothctl
  3. power on
  4. scan on and off when device is found.
  5. pair XX:XX

Now the pin code is shown in terminal and I can yes/no it, but DeviceB never shows it on its screen. And whatever I do, it will eventually go to timeout and connection will fail. Also tried to trust XX:XX in different occasions but never helped.

hciconfig -a shows:

hci0:   Type: Primary  Bus: SDIO
    BD Address: 88:DA:1A:EB:84:E3  ACL MTU: 1021:3  SCO MTU: 64:3
    UP RUNNING PSCAN 
    RX bytes:15113 acl:0 sco:0 events:156 errors:0
    TX bytes:0 acl:0 sco:0 commands:75 errors:0
    Features: 0xbf 0xc6 0x0d 0x7e 0x9b 0x1f 0x59 0x87
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 
    Link policy: RSWITCH SNIFF 
    Link mode: SLAVE ACCEPT 
    Name: 'BlueZ 5.54'
    Class: 0x000000
    Service Classes: Unspecified
    Device Class: Miscellaneous, 
    HCI Version: 5.0 (0x9)  Revision: 0x100
    LMP Version: 5.0 (0x9)  Subversion: 0x100
    Manufacturer: not assigned (1791)

Is there maybe some mismatch in Bluetooth versions used?

Any help or suggestions would be great and helpful.

Upvotes: -2

Views: 59

Answers (1)

Youssif Saeed
Youssif Saeed

Reputation: 13285

This pairing process is failing because of the IO capabilities and not the bonding type. As seen from the logs, the remote device (DeviceB) is indicating that its IO capabilities are DisplayYesNo. This means that the remote device has a Display, and also has the capability to answer with Yes/No. Then in return, DeviceA is also indicating that it has DisplayYesNo capabilities. As can be seen from the table below, this forces a numeric comparison where the same number is displayed, and both devices have to respond with a Yes to indicate that the numbers match.

IO Capabilities table

From your logs, I believe that the numberic comparison is failing, which is why the pairing process is failing. To fix this, you have one of two options:-

  • Find a way to reply YES to the numeric comparison from both devices. I believe on a desktop/laptop, you do get a prompt to hit Y or N to the pairing request, but I am not sure about how your Buildroot is set up.
  • Change the IO capabilities of the devices. Even if you can only change this on device A, you can still force a "JustWorks Unauthenticated" pairing, which should get the pairing process to work, but as stated, the pairing will be unauthenticated. You can do this by launching bluetoothctl with the following argument:-

Display only:

$bluetoothctl --agent DisplayOnly

No Input/Output:

$bluetoothctl --agent NoInputNoOutput

You can find more info about this at the links below:-

Upvotes: 1

Related Questions