We are using the latest master of pc-ble-driver-py. Pairing using a passkey fails frequently. The problem seems to be that the frame with the passkey contains a corrupted value.
Since ble_driver.py or ble_adapter.py do not offer methods for passkey entry, we are using the sd_ble_gap_auth_key_reply method of the underlying driver.
Example: After getting a on_gap_evt_auth_key_request, we call sd_ble_gap_auth_key_reply with passkey=913858
The pairing fails with BLE_GAP_SEC_STATUS_CONFIRM_VALUE. Looking in the debug output, the following packet was sent:
pc_ble_driver_py.ble_adapter DEBUG 24 -> [00 80 00 00 01 01 39 31 33 38 c8 69 ] type: VENDOR_SPECIFIC reliable:yes seq#:6 ack#:1 payload_length:c data_integrity:1 header_checksum:64 err_code:0x0
Note the bytes 39 31 33 38 c8 69. The expected values would be 39 31 33 38 35 38.
Here are some more examples:
passkey: 308558 packet: [00 80 00 00 01 01 33 30 38 35 58 a9 ]
passkey: 045296 packet: [00 80 00 00 01 01 30 34 35 32 c8 69 ]
passkey: 773757 packet: [00 80 00 00 01 01 37 37 33 37 c8 69 ]
When the correct passkey is in the packet, pairing works (BLE_GAP_SEC_STATUS_SUCCESS).
Is there anything we are doing wrong?
Below is some more context from the debug output: