How to know that the device disconnected due to an authentication failure

Hi,

I configured for using security BT_SECURITY_L2 for a device that I had previously configured for using BT_SECURITY_L4. When I try to connect with an Android phone that was previously paired when configured for BT_SECURITY_L4, it prints "SMP does not allow a pairing failure at this point. Known issue. Disconnecting instead." to the log and then disconnects.

From this question [here], for solving this issue I need to call bt_unpair(...) to erase bonding information.

How can I know, inside the callback disconnected, that the connection was closed with BT_HCI_ERR_AUTH_FAIL? I always receive reason 22 (BT_HCI_ERR_LOCALHOST_TERM_CONN).

BR

Parents Reply
  • I suspect this is a corner case that you encounter during development and not on an end product.

    You can try to add the kconfig options I have suggested just to check if that make any difference.

    Can tell me which side had keys intact here when you encountered the issue, is it the phone or the peripheral that still had the keys intact?

    Kenneth

Children
Related