Merge branch 'bugfix/fix_send_delete_link_key_cmd_1_v5.3' into 'release/v5.3'

Bugfix/fix send delete link key cmd 1 (v5.3)

See merge request espressif/esp-idf!39444
This commit is contained in:
Island
2025-05-28 10:58:42 +08:00
6 changed files with 16 additions and 6 deletions

View File

@ -154,9 +154,9 @@ uint32_t btc_get_ble_status(void)
#if (SMP_INCLUDED == TRUE)
// Number of recorded devices
extern uint8_t btm_ble_sec_dev_active_count(void);
if (btm_ble_sec_dev_active_count()) {
status |= BIT(BTC_BLE_STATUS_KEYS);
extern uint8_t btm_ble_sec_dev_record_count(void);
if (btm_ble_sec_dev_record_count()) {
status |= BIT(BTC_BLE_STATUS_DEVICE_REC);
}
// Number of saved bonded devices

View File

@ -34,7 +34,7 @@ typedef enum {
BTC_BLE_STATUS_EXT_ADV, // Extended advertising exist
BTC_BLE_STATUS_SCAN, // Scanning exist
BTC_BLE_STATUS_CONN, // Connection exist
BTC_BLE_STATUS_KEYS, // Device keys record exist
BTC_BLE_STATUS_DEVICE_REC, // Device record exist
BTC_BLE_STATUS_BOND, // Bond info exist
BTC_BLE_STATUS_GATTC_CACHE, // GATTC cache exist
BTC_BLE_STATUS_GATTC_APP, // GATTC application exist

View File

@ -2946,7 +2946,7 @@ uint8_t btm_ble_scan_active_count(void)
}
#if (SMP_INCLUDED == TRUE)
uint8_t btm_ble_sec_dev_active_count(void)
uint8_t btm_ble_sec_dev_record_count(void)
{
tBTM_SEC_DEV_REC *p_dev_rec = NULL;
list_node_t *p_node = NULL;
@ -2962,6 +2962,12 @@ uint8_t btm_ble_sec_dev_active_count(void)
return count;
}
void btm_ble_clear_sec_dev_record(void)
{
/* only used when connection is closed */
if(btm_cb.p_sec_dev_rec_list) list_clear(btm_cb.p_sec_dev_rec_list);
}
#endif
#if (BLE_PRIVACY_SPT == TRUE)

View File

@ -187,8 +187,10 @@ BOOLEAN BTM_SecDeleteDevice (BD_ADDR bd_addr, tBT_TRANSPORT transport)
}
if ((p_dev_rec = btm_find_dev(bd_addr)) != NULL) {
#if (CLASSIC_BT_INCLUDED == TRUE)
/* Tell controller to get rid of the link key, if it has one stored */
BTM_DeleteStoredLinkKey (p_dev_rec->bd_addr, NULL);
#endif // (CLASSIC_BT_INCLUDED == TRUE)
btm_sec_free_dev(p_dev_rec, transport);
}

View File

@ -1149,6 +1149,7 @@ tBTM_STATUS BTM_EnableTestMode(void)
}
#endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function BTM_DeleteStoredLinkKey
@ -1223,6 +1224,7 @@ void btm_delete_stored_link_key_complete (UINT8 *p)
}
}
#endif // (CLASSIC_BT_INCLUDED == TRUE)
/*******************************************************************************
**
** Function btm_report_device_status

View File

@ -1001,12 +1001,12 @@ tBTM_STATUS btm_sec_bond_by_transport (BD_ADDR bd_addr, tBT_TRANSPORT transport,
return (BTM_SUCCESS);
}
#if (CLASSIC_BT_INCLUDED == TRUE)
/* Tell controller to get rid of the link key if it has one stored */
if ((BTM_DeleteStoredLinkKey (bd_addr, NULL)) != BTM_SUCCESS) {
return (BTM_NO_RESOURCES);
}
#if (CLASSIC_BT_INCLUDED == TRUE)
/* Save the PIN code if we got a valid one */
if (p_pin && (pin_len <= PIN_CODE_LEN) && (pin_len != 0)) {
btm_cb.pin_code_len = pin_len;