mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
fix(ble/bluedroid): report conn param update failure for unknown BD_ADDR
Route unknown BD_ADDR and other immediate failures through the existing
need_cb path so ESP_GAP_BLE_UPDATE_CONN_PARAMS_EVT is always delivered.
(cherry picked from commit f9eaeb5e84)
Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
This commit is contained in:
committed by
zhanghaipeng
parent
4d7da7ff48
commit
f789848cc5
@@ -147,17 +147,15 @@ BOOLEAN L2CA_UpdateBleConnParams (BD_ADDR rem_bda, UINT16 min_int, UINT16 max_in
|
|||||||
/* See if we have a link control block for the remote device */
|
/* See if we have a link control block for the remote device */
|
||||||
p_lcb = l2cu_find_lcb_by_bd_addr (rem_bda, BT_TRANSPORT_LE);
|
p_lcb = l2cu_find_lcb_by_bd_addr (rem_bda, BT_TRANSPORT_LE);
|
||||||
|
|
||||||
/* If we don't have one, create one and accept the connection. */
|
|
||||||
if (!p_lcb || !p_acl_cb) {
|
if (!p_lcb || !p_acl_cb) {
|
||||||
L2CAP_TRACE_WARNING ("L2CA_UpdateBleConnParams - unknown BD_ADDR "MACSTR"", MAC2STR(rem_bda));
|
L2CAP_TRACE_WARNING ("L2CA_UpdateBleConnParams - unknown BD_ADDR "MACSTR"", MAC2STR(rem_bda));
|
||||||
return (FALSE);
|
status = HCI_ERR_NO_CONNECTION;
|
||||||
}
|
need_cb = true;
|
||||||
|
} else if (p_lcb->transport != BT_TRANSPORT_LE) {
|
||||||
if (p_lcb->transport != BT_TRANSPORT_LE) {
|
|
||||||
L2CAP_TRACE_WARNING ("L2CA_UpdateBleConnParams - BD_ADDR "MACSTR" not LE", MAC2STR(rem_bda));
|
L2CAP_TRACE_WARNING ("L2CA_UpdateBleConnParams - BD_ADDR "MACSTR" not LE", MAC2STR(rem_bda));
|
||||||
return (FALSE);
|
status = HCI_ERR_NO_CONNECTION;
|
||||||
}
|
need_cb = true;
|
||||||
|
} else {
|
||||||
/* Check whether the request conn params is already set */
|
/* Check whether the request conn params is already set */
|
||||||
if ((max_int == p_lcb->current_used_conn_interval) && (latency == p_lcb->current_used_conn_latency) &&
|
if ((max_int == p_lcb->current_used_conn_interval) && (latency == p_lcb->current_used_conn_latency) &&
|
||||||
(timeout == p_lcb->current_used_conn_timeout)) {
|
(timeout == p_lcb->current_used_conn_timeout)) {
|
||||||
@@ -171,16 +169,20 @@ BOOLEAN L2CA_UpdateBleConnParams (BD_ADDR rem_bda, UINT16 min_int, UINT16 max_in
|
|||||||
need_cb = true;
|
need_cb = true;
|
||||||
L2CAP_TRACE_ERROR("%s connection parameter update in progress, please try later", __func__);
|
L2CAP_TRACE_ERROR("%s connection parameter update in progress, please try later", __func__);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (need_cb) {
|
if (need_cb) {
|
||||||
tBTM_BLE_LEGACY_GAP_CB_PARAMS cb_params = {0};
|
tBTM_BLE_LEGACY_GAP_CB_PARAMS cb_params = {0};
|
||||||
cb_params.conn_params_update.status = status;
|
cb_params.conn_params_update.status = status;
|
||||||
memcpy(cb_params.conn_params_update.remote_bd_addr, p_lcb->remote_bd_addr, BD_ADDR_LEN);
|
memcpy(cb_params.conn_params_update.remote_bd_addr,
|
||||||
|
p_lcb ? p_lcb->remote_bd_addr : rem_bda, BD_ADDR_LEN);
|
||||||
cb_params.conn_params_update.min_conn_int = min_int;
|
cb_params.conn_params_update.min_conn_int = min_int;
|
||||||
cb_params.conn_params_update.max_conn_int = max_int;
|
cb_params.conn_params_update.max_conn_int = max_int;
|
||||||
|
if (p_lcb) {
|
||||||
cb_params.conn_params_update.conn_int = p_lcb->current_used_conn_interval;
|
cb_params.conn_params_update.conn_int = p_lcb->current_used_conn_interval;
|
||||||
cb_params.conn_params_update.slave_latency = p_lcb->current_used_conn_latency;
|
cb_params.conn_params_update.slave_latency = p_lcb->current_used_conn_latency;
|
||||||
cb_params.conn_params_update.supervision_tout = p_lcb->current_used_conn_timeout;
|
cb_params.conn_params_update.supervision_tout = p_lcb->current_used_conn_timeout;
|
||||||
|
}
|
||||||
|
|
||||||
BTM_LegacyBleCallbackTrigger(BTM_BLE_LEGACY_GAP_CONNECTION_PARAMS_UPDATE_EVT, &cb_params);
|
BTM_LegacyBleCallbackTrigger(BTM_BLE_LEGACY_GAP_CONNECTION_PARAMS_UPDATE_EVT, &cb_params);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user