Skip to content

Commit

Permalink
Merge branch 'bugfix/fix_some_ble_bugs_240310_v5.1' into 'release/v5.1'
Browse files Browse the repository at this point in the history
Bugfix/fix some ble bugs 240310 v5.1(backport v5.1)

See merge request espressif/esp-idf!29518
  • Loading branch information
jack0c committed Mar 12, 2024
2 parents 635ab30 + 672775b commit b0fb3bb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
5 changes: 5 additions & 0 deletions components/bt/host/bluedroid/bta/dm/bta_dm_act.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,11 @@ void bta_dm_disable (tBTA_DM_MSG *p_data)
btm_ble_resolving_list_cleanup (); //by TH, because cmn_ble_vsc_cb.max_filter has something mistake as btm_ble_adv_filter_cleanup
#endif

#if BLE_INCLUDED == TRUE
// btm_ble_multi_adv_init is called when the host is enabled, so btm_ble_multi_adv_cleanup is called when the host is disabled.
btm_ble_multi_adv_cleanup();
#endif

}

/*******************************************************************************
Expand Down
1 change: 0 additions & 1 deletion components/bt/host/bluedroid/bta/dm/bta_dm_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -2795,7 +2795,6 @@ void BTA_VendorCleanup (void)
}
#endif

btm_ble_multi_adv_cleanup();
}
#if (BLE_50_FEATURE_SUPPORT == TRUE)
void BTA_DmBleGapReadPHY(BD_ADDR addr)
Expand Down
9 changes: 7 additions & 2 deletions components/bt/host/bluedroid/stack/btm/btm_ble_5_gap.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,8 +796,13 @@ tBTM_STATUS BTM_BlePeriodicAdvCreateSync(tBTM_BLE_Periodic_Sync_Params *params)
|| (params->reports_disabled > 0x01)
|| (params->filter_duplicates > 0x01)
#endif
|| (params->addr_type > 0x01) ||
(params->sid > 0xf) || (params->skip > 0x01F3)) {
/*If the Periodic Advertiser List is not used,
the Advertising_SID, Advertiser Address_Type, and Advertiser Address
parameters specify the periodic advertising device to listen to; otherwise they
shall be ignored.*/
|| (params->filter_policy == 0 && params->addr_type > 0x01)
|| (params->filter_policy == 0 && params->sid > 0xf)
|| (params->skip > 0x01F3)) {
status = BTM_ILLEGAL_VALUE;
BTM_TRACE_ERROR("%s, The sync parameters is invalid.", __func__);
goto end;
Expand Down
7 changes: 7 additions & 0 deletions components/bt/host/bluedroid/stack/btm/btm_ble_multi_adv.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,13 @@ void btm_ble_multi_adv_init(void)
*******************************************************************************/
void btm_ble_multi_adv_cleanup(void)
{
#if BTM_DYNAMIC_MEMORY == TRUE
if (btm_multi_adv_cb_ptr == NULL)
{
BTM_TRACE_WARNING("%s memory has been freed", __func__);
return;
}
#endif
if (btm_multi_adv_cb.p_adv_inst) {
osi_free(btm_multi_adv_cb.p_adv_inst);
btm_multi_adv_cb.p_adv_inst = NULL;
Expand Down

0 comments on commit b0fb3bb

Please sign in to comment.