Loading system/stack/btm/ble_advertiser_hci_interface.cc +14 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <utility> #include "btm_api.h" #include "btm_ble_api.h" #include "btm_int_types.h" #include "device/include/controller.h" #define BTM_BLE_MULTI_ADV_SET_RANDOM_ADDR_LEN 8 Loading Loading @@ -203,6 +204,19 @@ class BleAdvertiserVscHciInterfaceImpl : public BleAdvertiserHciInterface { command_complete); } bool QuirkAdvertiserZeroHandle() override { // Android BT HCI Requirements version 0.96 and below specify that handle 0 // is equal to standard HCI interface, and should be accessed using non-VSC // commands. Broadcom controllers are strict about this requirement, so // don't use 0 handle. if (BTM_IS_BRCM_CONTROLLER()) { LOG(INFO) << "QuirkAdvertiserZeroHandle in use"; return true; } return false; } public: static void VendorSpecificEventCback(uint8_t length, uint8_t* p) { VLOG(1) << __func__; Loading system/stack/btm/ble_advertiser_hci_interface.h +3 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,9 @@ class BleAdvertiserHciInterface { virtual void Enable(uint8_t enable, uint8_t handle, uint16_t duration, uint8_t max_extended_advertising_events, status_cb command_complete) = 0; // Some implementation don't behave well when handle value 0 is used. virtual bool QuirkAdvertiserZeroHandle() { return 0; } }; #endif // BLE_ADVERTISER_HCI_INTERFACE_H system/stack/btm/btm_ble_multi_adv.cc +6 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ void btm_ble_adv_raddr_timer_timeout(void* data); namespace { void DoNothing(uint8_t) {} void DoNothing2(uint8_t, uint8_t) {} std::queue<base::Callback<void(tBTM_RAND_ENC* p)>>* rand_gen_inst_id = nullptr; Loading Loading @@ -511,6 +512,11 @@ void btm_ble_adv_init() { BleAdvertisingManager::Initialize(BleAdvertiserHciInterface::Get()); BleAdvertiserHciInterface::Get()->SetAdvertisingEventObserver( (BleAdvertisingManagerImpl*)BleAdvertisingManager::Get()); if (BleAdvertiserHciInterface::Get()->QuirkAdvertiserZeroHandle()) { // If handle 0 can't be used, register advertiser for it, but never use it. BleAdvertisingManager::Get()->RegisterAdvertiser(Bind(DoNothing2)); } } /******************************************************************************* Loading Loading
system/stack/btm/ble_advertiser_hci_interface.cc +14 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ #include <utility> #include "btm_api.h" #include "btm_ble_api.h" #include "btm_int_types.h" #include "device/include/controller.h" #define BTM_BLE_MULTI_ADV_SET_RANDOM_ADDR_LEN 8 Loading Loading @@ -203,6 +204,19 @@ class BleAdvertiserVscHciInterfaceImpl : public BleAdvertiserHciInterface { command_complete); } bool QuirkAdvertiserZeroHandle() override { // Android BT HCI Requirements version 0.96 and below specify that handle 0 // is equal to standard HCI interface, and should be accessed using non-VSC // commands. Broadcom controllers are strict about this requirement, so // don't use 0 handle. if (BTM_IS_BRCM_CONTROLLER()) { LOG(INFO) << "QuirkAdvertiserZeroHandle in use"; return true; } return false; } public: static void VendorSpecificEventCback(uint8_t length, uint8_t* p) { VLOG(1) << __func__; Loading
system/stack/btm/ble_advertiser_hci_interface.h +3 −0 Original line number Diff line number Diff line Loading @@ -71,6 +71,9 @@ class BleAdvertiserHciInterface { virtual void Enable(uint8_t enable, uint8_t handle, uint16_t duration, uint8_t max_extended_advertising_events, status_cb command_complete) = 0; // Some implementation don't behave well when handle value 0 is used. virtual bool QuirkAdvertiserZeroHandle() { return 0; } }; #endif // BLE_ADVERTISER_HCI_INTERFACE_H
system/stack/btm/btm_ble_multi_adv.cc +6 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ void btm_ble_adv_raddr_timer_timeout(void* data); namespace { void DoNothing(uint8_t) {} void DoNothing2(uint8_t, uint8_t) {} std::queue<base::Callback<void(tBTM_RAND_ENC* p)>>* rand_gen_inst_id = nullptr; Loading Loading @@ -511,6 +512,11 @@ void btm_ble_adv_init() { BleAdvertisingManager::Initialize(BleAdvertiserHciInterface::Get()); BleAdvertiserHciInterface::Get()->SetAdvertisingEventObserver( (BleAdvertisingManagerImpl*)BleAdvertisingManager::Get()); if (BleAdvertiserHciInterface::Get()->QuirkAdvertiserZeroHandle()) { // If handle 0 can't be used, register advertiser for it, but never use it. BleAdvertisingManager::Get()->RegisterAdvertiser(Bind(DoNothing2)); } } /******************************************************************************* Loading