Gatttool Pairing Failed (0x05)

人走茶凉 提交于 2020-06-27 16:56:29

问题


When I try to read a BLE characteristic which require encryption via GattTool on a RPI 3B

gatttool -b 04:EE:03:B1:47:DF --char-read --handle=0x000e --sec-level=low

It end up with an error Characteristic value/descriptor read failed: Request attribute has encountered an unlikely error

I tried with/without --sec-level=low|medium|high

hcidump

2020-06-05 10:35:50.696249 < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7
    type 0x00 (passive)
    interval 60.000ms window 30.000ms
    own address: 0x00 (Public) policy: white list only
2020-06-05 10:35:50.697091 > HCI Event: Command Complete (0x0e) plen 4
    LE Set Scan Parameters (0x08|0x000b) ncmd 1
    status 0x00
2020-06-05 10:35:50.697158 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
    value 0x01 (scanning enabled)
    filter duplicates 0x01 (enabled)
2020-06-05 10:35:50.697910 > HCI Event: Command Complete (0x0e) plen 4
    LE Set Scan Enable (0x08|0x000c) ncmd 1
    status 0x00
2020-06-05 10:35:50.909070 > HCI Event: LE Meta Event (0x3e) plen 33
    LE Advertising Report
      ADV_IND - Connectable undirected advertising (0)
      bdaddr 04:EE:03:B1:47:DF (Public)
      Flags: 0x06
      Unknown type 0x06 with 16 bytes data
      RSSI: -34
2020-06-05 10:35:50.909151 < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2
    value 0x00 (scanning disabled)
    filter duplicates 0x00 (disabled)
2020-06-05 10:35:50.911659 > HCI Event: Command Complete (0x0e) plen 4
    LE Set Scan Enable (0x08|0x000c) ncmd 1
    status 0x00
2020-06-05 10:35:50.911717 < HCI Command: LE Create Connection (0x08|0x000d) plen 25
    bdaddr 04:EE:03:B1:47:DF type 0
    interval 96 window 96 initiator_filter 0
    own_bdaddr_type 0 min_interval 24 max_interval 40
    latency 0 supervision_to 42 min_ce 0 max_ce 0
2020-06-05 10:35:50.912840 > HCI Event: Command Status (0x0f) plen 4
    LE Create Connection (0x08|0x000d) status 0x00 ncmd 1
2020-06-05 10:35:52.419884 > HCI Event: LE Meta Event (0x3e) plen 19
    LE Connection Complete
      status 0x00 handle 64, role master
      bdaddr 04:EE:03:B1:47:DF (Public)
2020-06-05 10:35:52.420183 < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2
  40 00 
2020-06-05 10:35:52.421473 > HCI Event: Command Status (0x0f) plen 4
    LE Read Remote Used Features (0x08|0x0016) status 0x00 ncmd 1
2020-06-05 10:35:52.588728 > HCI Event: LE Meta Event (0x3e) plen 12
    LE Read Remote Used Features Complete
      status 0x00 handle 64
      Features: 0x1d 0x00 0x00 0x00 0x00 0x00 0x00 0x00
2020-06-05 10:35:52.596785 < ACL data: handle 64 flags 0x00 dlen 7
    ATT: Read req (0x0a)
      handle 0x000e
2020-06-05 10:35:52.686141 > ACL data: handle 64 flags 0x02 dlen 9
    ATT: Error (0x01)
      Error: Insufficient authentication (5)
      Read req (0x0a) on handle 0x000e
2020-06-05 10:35:52.884191 > HCI Event: Number of Completed Packets (0x13) plen 5
    handle 64 packets 1
2020-06-05 10:35:52.884221 < ACL data: handle 64 flags 0x00 dlen 11
    SMP: Pairing Request (0x01)
      capability 0x04 oob 0x00 auth req 0x2d
      max key size 0x10 init key dist 0x0d resp key dist 0x0f
      Capability: KeyboardDisplay (OOB data not present)
      Authentication: Bonding (MITM Protection)
      Initiator Key Distribution:  LTK  CSRK
      Responder Key Distribution:  LTK IRK CSRK
2020-06-05 10:35:52.978584 > ACL data: handle 64 flags 0x02 dlen 6
    SMP: Pairing Failed (0x05)
      reason 0x05
      Reason Pairing Not Supported
2020-06-05 10:35:52.978640 < HCI Command: Disconnect (0x01|0x0006) plen 3
    handle 64 reason 0x05
    Reason: Authentication Failure
2020-06-05 10:35:52.979073 > HCI Event: Command Status (0x0f) plen 4
    Disconnect (0x01|0x0006) status 0x00 ncmd 1
2020-06-05 10:35:53.027840 > HCI Event: Number of Completed Packets (0x13) plen 5
    handle 64 packets 1
2020-06-05 10:35:53.027952 > HCI Event: Disconn Complete (0x05) plen 4
    status 0x00 handle 64 reason 0x16
    Reason: Connection Terminated by Local Host

Anyone know how to fix this pairing issue ?

Edit

I was able to proceed to pairing on iOS (via cordova BLE central plugin), here is the packed logger : https://gist.github.com/buildog/f65fb3b0d5a75d0b6aad26a7d71e9433

I don't now how to mimics this procedure on linux via Gatttool.

Fix

This was an issue with device itself which have inconsistant pairing capacities

来源:https://stackoverflow.com/questions/62212363/gatttool-pairing-failed-0x05

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!