Skip to content

Commit a172dac

Browse files
committed
Merge branch 'bugfix/fix_blecibr25_119' into 'master'
fix(ble/bluedroid): Fixed extended adv restart failure during reconnection Closes BLERP-1969, BLERP-1970, BLERP-1971, and BLERP-1979 See merge request espressif/esp-idf!39709
2 parents 0fa5b07 + 6392180 commit a172dac

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,7 @@ tBTM_STATUS BTM_BleStartExtAdvRestart(uint8_t con_handle)
613613
}
614614

615615
if((index >= MAX_BLE_ADV_INSTANCE) || (!adv_record[index].invalid)) {
616+
BTM_TRACE_WARNING("%s failed to find extend adv, adv_handle %u con_handle %u", __func__, index, con_handle);
616617
return BTM_WRONG_MODE;
617618
}
618619

@@ -1254,7 +1255,7 @@ void btm_ble_adv_set_terminated_evt(tBTM_BLE_ADV_TERMINAT *params)
12541255
}
12551256

12561257
// adv terminated due to connection, save the adv handle and connection handle
1257-
if(params->completed_event == 0x00) {
1258+
if(params->status == 0x00) {
12581259
adv_record[params->adv_handle].ter_con_handle = params->conn_handle;
12591260
} else {
12601261
adv_record[params->adv_handle].ter_con_handle = INVALID_VALUE;

components/bt/host/bluedroid/stack/l2cap/l2c_link.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,8 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
480480
if (l2cu_create_conn(p_lcb, BT_TRANSPORT_LE)) {
481481
btm_acl_removed (p_lcb->remote_bd_addr, BT_TRANSPORT_LE);
482482
lcb_is_free = FALSE; /* still using this lcb */
483+
} else {
484+
L2CAP_TRACE_ERROR("master retry connect failed");
483485
}
484486
}
485487
#endif // (GATTC_CONNECT_RETRY_EN == TRUE)
@@ -489,7 +491,10 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
489491
if(btm_ble_inter_get() && p_lcb->link_role == HCI_ROLE_SLAVE) {
490492
p_lcb->retry_create_con ++;
491493
L2CAP_TRACE_DEBUG("slave restart extend adv, retry count %d reason 0x%x\n", p_lcb->retry_create_con, reason);
492-
BTM_BleStartExtAdvRestart(handle);
494+
tBTM_STATUS start_adv_status = BTM_BleStartExtAdvRestart(handle);
495+
if (start_adv_status != BTM_SUCCESS) {
496+
L2CAP_TRACE_ERROR("slave restart extend adv failed (err 0x%x)", start_adv_status);
497+
}
493498
}
494499
#endif // #if (BLE_50_EXTEND_ADV_EN == TRUE)
495500
#endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
@@ -499,7 +504,10 @@ BOOLEAN l2c_link_hci_disc_comp (UINT16 handle, UINT8 reason)
499504
if(!btm_ble_inter_get() && p_lcb->link_role == HCI_ROLE_SLAVE) {
500505
p_lcb->retry_create_con ++;
501506
L2CAP_TRACE_DEBUG("slave resatrt adv, retry count %d reason 0x%x\n", p_lcb->retry_create_con, reason);
502-
btm_ble_start_adv();
507+
tBTM_STATUS start_adv_status = btm_ble_start_adv();
508+
if (start_adv_status != BTM_SUCCESS) {
509+
L2CAP_TRACE_ERROR("slave resatrt adv failed (err 0x%x)", start_adv_status);
510+
}
503511
}
504512
#endif // #if (BLE_42_ADV_EN == TRUE)
505513
#endif // #if (BLE_42_FEATURE_SUPPORT == TRUE)

0 commit comments

Comments
 (0)