This is an automated email from the ASF dual-hosted git repository.
janc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
The following commit(s) were added to refs/heads/master by this push:
new bd6d94c88 nimble/host: L2CAP fallback for LL conn param rejection
bd6d94c88 is described below
commit bd6d94c88fa12b47482a77d1284279870ed86058
Author: Gerard Marull-Paretas <[email protected]>
AuthorDate: Mon Mar 30 10:53:49 2026 +0200
nimble/host: L2CAP fallback for LL conn param rejection
When the peripheral calls ble_gap_update_params() and the peer's
supported features indicate CONN_PARAM_REQUEST support, NimBLE sends
the LE Connection Update HCI command. However, if the peer's controller
does not support the BLE 4.1 LL Connection Parameters Request procedure,
the HCI command is rejected synchronously with
BLE_ERR_UNSUPP_REM_FEATURE (0x1a).
NimBLE already handles this error asynchronously in
ble_gap_rx_update_complete() by falling back to L2CAP signaling, but
the synchronous rejection path had no such fallback, causing the update
to fail and be retried futilely by upper layers.
Add a synchronous fallback: when ble_gap_update_tx() returns
BLE_ERR_UNSUPP_REM_FEATURE and the local device is the slave, switch to
the L2CAP Connection Parameter Update Request procedure.
Signed-Off-By: Gerard Marull-Paretas <[email protected]>
---
nimble/host/src/ble_gap.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c
index 435c90b46..62eef56de 100644
--- a/nimble/host/src/ble_gap.c
+++ b/nimble/host/src/ble_gap.c
@@ -6344,6 +6344,18 @@ ble_gap_update_params(uint16_t conn_handle,
rc = 0;
} else {
rc = ble_gap_update_tx(conn_handle, params);
+
+ /*
+ * If the controller rejects the LL update with "Unsupported Remote
+ * Feature" and we are the slave, fall back to L2CAP signaling. This
+ * happens when the local controller supports the Connection Parameters
+ * Request procedure but the peer's controller does not.
+ */
+ if (rc == BLE_HS_HCI_ERR(BLE_ERR_UNSUPP_REM_FEATURE) &&
+ !(conn->bhc_flags & BLE_HS_CONN_F_MASTER)) {
+ l2cap_update = 1;
+ rc = 0;
+ }
}
done: