初始连接后BlueZ BLE Pin或Key Missing身份验证错误

时间:2018-01-22 14:51:40

标签: bluetooth embedded bluetooth-lowenergy bluez

似乎在最初与某些BLE设备配对/连接后(在这种情况下,脉冲为ox),任何后续连接都会导致PIN或密钥丢失(0x06)错误。我可以使用bluetoothctl或类似的工具删除设备,然后我可以再次连接,但我试图找出实际问题是什么,以便我可以使这个工作。我使用BlueZ 5.47,在这种情况下,我只是试图通过gatttool与设备通信(第一次工作,而不是在进行有效连接后的任何后续时间)。我已经阅读了一些人们描述类似问题的门票,但到目前为止我唯一看到的解决方案是在配对前删除设备。

以下是失败连接的btmon日志:

< HCI Command: LE Create Connection (0x08|0x000d) plen 25                                                                               #3 [hci0] 91.335394
        Scan interval: 60.000 msec (0x0060)
        Scan window: 30.000 msec (0x0030)
        Filter policy: White list is not used (0x00)
        Peer address type: Public (0x00)
        Peer address: 00:1C:05:FF:9C:A5 (OUI 00-1C-05)
        Own address type: Public (0x00)
        Min connection interval: 50.00 msec (0x0028)
        Max connection interval: 70.00 msec (0x0038)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Min connection length: 0.000 msec (0x0000)
        Max connection length: 0.000 msec (0x0000)
> HCI Event: Command Status (0x0f) plen 4                                                                                               #4 [hci0] 91.347480
      LE Create Connection (0x08|0x000d) ncmd 1
        Status: Success (0x00)
> HCI Event: LE Meta Event (0x3e) plen 19                                                                                               #5 [hci0] 92.874610
      LE Connection Complete (0x01)
        Status: Success (0x00)
        Handle: 1025
        Role: Master (0x00)
        Peer address type: Public (0x00)
        Peer address: 00:1C:05:FF:9C:A5 (OUI 00-1C-05)
        Connection interval: 70.00 msec (0x0038)
        Connection latency: 0 (0x0000)
        Supervision timeout: 420 msec (0x002a)
        Master clock accuracy: 0x01
@ Device Connected: 00:1C:05:FF:9C:A5 (1) flags 0x0000
< ACL Data TX: Handle 1025 flags 0x00 dlen 8                                                                                            #6 [hci0] 92.928535
      ATT: Write Request (0x12) len 3
        Handle: 0x0019
          Data: 01
> ACL Data RX: Handle 1025 flags 0x02 dlen 6                                                                                            #7 [hci0] 92.977319
      SMP: Security Request (0x0b) len 1
        Authentication requirement: No bonding, No MITM, Legacy, No Keypresses (0x00)
< HCI Command: LE Start Encryption (0x08|0x0019) plen 28                                                                                #8 [hci0] 92.977466
        Handle: 1025
        Random number: 0x8f15c8e27f50c2fc
        Encrypted diversifier: 0x6ee1
        Long term key: b3c9837306766fd8d4024ae4549c6337
> HCI Event: Command Status (0x0f) plen 4                                                                                               #9 [hci0] 92.988087
      LE Start Encryption (0x08|0x0019) ncmd 1
        Status: Success (0x00)
> ACL Data RX: Handle 1025 flags 0x02 dlen 5                                                                                           #10 [hci0] 93.117417
      ATT: Write Response (0x13) len 0
> HCI Event: Number of Completed Packets (0x13) plen 5                                                                                 #11 [hci0] 93.145136
        Num handles: 1
        Handle: 1025
        Count: 1
> HCI Event: Encryption Change (0x08) plen 4                                                                                           #12 [hci0] 93.327778
        Status: PIN or Key Missing (0x06)
        Handle: 1025
        Encryption: Disabled (0x00)
< HCI Command: Disconnect (0x01|0x0006) plen 3                                                                                         #13 [hci0] 93.327909
        Handle: 1025
        Reason: Authentication Failure (0x05)
> HCI Event: Command Status (0x0f) plen 4                                                                                              #14 [hci0] 93.333590
      Disconnect (0x01|0x0006) ncmd 1
        Status: Success (0x00)
> HCI Event: Disconnect Complete (0x05) plen 4                                                                                         #15 [hci0] 93.397883
        Status: Success (0x00)
        Handle: 1025
        Reason: Authentication Failure (0x05)

1 个答案:

答案 0 :(得分:0)

在调查另一个BLE问题时,我最终遇到了您的SO问题。您的问题似乎与3.8中修复的以下Linux内核错误有关:https://lore.kernel.org/patchwork/patch/458251/