fix(ble/bluedroid): Fixed init crash when bluedroid BLE is enabled in BREDR only mode

This commit is contained in:
zhiweijian
2026-04-27 11:47:23 +08:00
parent 093a521048
commit 666c1894c5
3 changed files with 12 additions and 3 deletions
+1 -1
View File
@@ -272,7 +272,7 @@ config BT_GOEPC_ENABLED
config BT_BLE_ENABLED config BT_BLE_ENABLED
bool "Bluetooth Low Energy" bool "Bluetooth Low Energy"
depends on BT_BLUEDROID_ENABLED depends on BT_BLUEDROID_ENABLED && (!BTDM_CTRL_MODE_BR_EDR_ONLY)
default y default y
help help
This enables Bluetooth Low Energy This enables Bluetooth Low Energy
@@ -234,7 +234,10 @@ static void start_up(void)
#if (BLE_INCLUDED == TRUE) #if (BLE_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED) #if (CLASSIC_BT_INCLUDED)
controller_param.ble_supported = controller_param.last_features_classic_page_index >= 1 && HCI_LE_HOST_SUPPORTED(controller_param.features_classic[1].as_array); controller_param.ble_supported = controller_param.last_features_classic_page_index >= 1 && HCI_LE_HOST_SUPPORTED(controller_param.features_classic[1].as_array);
#else if (!controller_param.ble_supported) {
LOG_ERROR("Controller does not support BLE, please disable host BLE");
}
#else
controller_param.ble_supported = true; controller_param.ble_supported = true;
#endif #endif
if (controller_param.ble_supported) { if (controller_param.ble_supported) {
@@ -508,7 +511,9 @@ static uint16_t get_acl_packet_size_ble(void)
static uint16_t get_ble_suggested_default_data_length(void) static uint16_t get_ble_suggested_default_data_length(void)
{ {
assert(controller_param.readable); assert(controller_param.readable);
assert(controller_param.ble_supported); if (!controller_param.ble_supported) {
return 0;
}
return controller_param.ble_suggested_default_data_length; return controller_param.ble_suggested_default_data_length;
} }
@@ -1201,6 +1201,10 @@ void btm_ble_resolving_list_cleanup(void)
#if (CONTROLLER_RPA_LIST_ENABLE == TRUE) #if (CONTROLLER_RPA_LIST_ENABLE == TRUE)
void btm_ble_add_default_entry_to_resolving_list(void) void btm_ble_add_default_entry_to_resolving_list(void)
{ {
const controller_t *controller = controller_get_interface();
if (!controller->supports_ble()) {
return;
}
/* /*
* Add local IRK entry with 00:00:00:00:00:00 address. This entry will * Add local IRK entry with 00:00:00:00:00:00 address. This entry will
* be used to generate RPA for non-directed advertising if own_addr_type * be used to generate RPA for non-directed advertising if own_addr_type