Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc9a6dbe authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Andre Eisenbach
Browse files

Fix AdvertisingManager not being initialized

When BLE_VND_INCLUDED is not set, advertising was not properly
initialized, which resulted in stack crashes. This patch makes sure that
LE advertising is always properly initialized

Bug: 33168939
Test: enable LE advertising with BLE_VND_INCLUDED set to false
Change-Id: I5fa0b3da39da99e750e1f8b6f0452a628094bfc4
parent 4d19af5a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -434,6 +434,11 @@ static void bta_dm_sys_hw_cback(tBTA_SYS_HW_EVT status) {

#if (BLE_VND_INCLUDED == TRUE)
    BTM_BleReadControllerFeatures(bta_dm_ctrl_features_rd_cmpl_cback);
#else
    /* If VSC multi adv commands are available, advertising will be initialized
     * when capabilities are read. If they are not avaliable, initialize
     * advertising here */
    btm_ble_adv_init();
#endif

    /* Earlier, we used to invoke BTM_ReadLocalAddr which was just copying the
+1 −1
Original line number Diff line number Diff line
@@ -539,7 +539,7 @@ static void btm_ble_vendor_capability_vsc_cmpl_cback(
      btm_cb.cmn_ble_vsc_cb.energy_support,
      btm_cb.cmn_ble_vsc_cb.extended_scan_support);

  if (BTM_BleMaxMultiAdvInstanceCount() > 0) btm_ble_multi_adv_init();
  btm_ble_adv_init();

  if (btm_cb.cmn_ble_vsc_cb.max_filter > 0) btm_ble_adv_filter_init();

+1 −1
Original line number Diff line number Diff line
@@ -178,7 +178,7 @@ extern void btm_ble_resolving_list_init(uint8_t max_irk_list_sz);
extern void btm_ble_resolving_list_cleanup(void);
#endif

extern void btm_ble_multi_adv_init(void);
extern void btm_ble_adv_init(void);
extern void* btm_ble_multi_adv_get_ref(uint8_t inst_id);
extern void btm_ble_multi_adv_cleanup(void);
extern void btm_ble_batchscan_init(void);
+4 −12
Original line number Diff line number Diff line
@@ -470,18 +470,10 @@ void btm_ble_adv_raddr_timer_timeout(void* data) {
      ->ConfigureRpa(((AdvertisingInstance*)data)->inst_id);
}

/*******************************************************************************
 *
 * Function         btm_ble_multi_adv_init
 *
 * Description      This function initialize the multi adv control block.
 *
 * Parameters       None
 *
 * Returns          void
 *
 ******************************************************************************/
void btm_ble_multi_adv_init() {
/**
 * This function initialize the advertising manager.
 **/
void btm_ble_adv_init() {
  BleAdvertiserHciInterface::Initialize();
  BleAdvertisingManager::Initialize(BleAdvertiserHciInterface::Get());
  BleAdvertiserHciInterface::Get()->SetAdvertisingEventObserver(