fix(ble/bluedroid): Fixed issue with deleting link key when classic Bluetooth is not used

(cherry picked from commit 7c16bce827)

Co-authored-by: zhanghaipeng <zhanghaipeng@espressif.com>
This commit is contained in:
Zhang Hai Peng
2025-05-27 15:13:59 +08:00
parent ba70c7f3d1
commit 80c5fd1836
3 changed files with 5 additions and 1 deletions

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 ((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 */ /* Tell controller to get rid of the link key, if it has one stored */
BTM_DeleteStoredLinkKey (p_dev_rec->bd_addr, NULL); BTM_DeleteStoredLinkKey (p_dev_rec->bd_addr, NULL);
#endif // (CLASSIC_BT_INCLUDED == TRUE)
btm_sec_free_dev(p_dev_rec, transport); 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) #endif // #if (BLE_HOST_ENABLE_TEST_MODE_EN == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
/******************************************************************************* /*******************************************************************************
** **
** Function BTM_DeleteStoredLinkKey ** 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 ** 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); return (BTM_SUCCESS);
} }
#if (CLASSIC_BT_INCLUDED == TRUE)
/* Tell controller to get rid of the link key if it has one stored */ /* Tell controller to get rid of the link key if it has one stored */
if ((BTM_DeleteStoredLinkKey (bd_addr, NULL)) != BTM_SUCCESS) { if ((BTM_DeleteStoredLinkKey (bd_addr, NULL)) != BTM_SUCCESS) {
return (BTM_NO_RESOURCES); return (BTM_NO_RESOURCES);
} }
#if (CLASSIC_BT_INCLUDED == TRUE)
/* Save the PIN code if we got a valid one */ /* Save the PIN code if we got a valid one */
if (p_pin && (pin_len <= PIN_CODE_LEN) && (pin_len != 0)) { if (p_pin && (pin_len <= PIN_CODE_LEN) && (pin_len != 0)) {
btm_cb.pin_code_len = pin_len; btm_cb.pin_code_len = pin_len;