Skip to content

Commit

Permalink
Bluetooth: Add wrn on BT_HCI_ERR_CONN_FAIL_TO_ESTAB
Browse files Browse the repository at this point in the history
Recently (during Bluetooth UPF), a lot of developers experience
confusion due to weird errors in SMP, etc, which are actually irrelevant
and caused by the connection never having existed.

As a stop-gap measure, until upper layers properly report lower layer
failures, add a warning in the logs to stop wasting developer time.

Signed-off-by: Aleksander Wasaznik <[email protected]>
  • Loading branch information
alwa-nordic authored and carlescufi committed Mar 21, 2024
1 parent 38117c6 commit 0d44528
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions subsys/bluetooth/host/conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -1247,6 +1247,16 @@ void bt_conn_set_state(struct bt_conn *conn, bt_conn_state_t state)
break;
#endif /* CONFIG_BT_CONN */
case BT_CONN_DISCONNECT_COMPLETE:
if (conn->err == BT_HCI_ERR_CONN_FAIL_TO_ESTAB) {
/* No ACK or data was ever received. The peripheral may be
* unaware of the connection attempt.
*
* Beware of confusing higher layer errors. Anything that looks
* like it's from the remote is synthetic.
*/
LOG_WRN("conn %p failed to establish. RF noise?", conn);
}

process_unack_tx(conn);
break;
default:
Expand Down

0 comments on commit 0d44528

Please sign in to comment.