From daf2622a5b53b4558c5de9fa9c879a26044d7405 Mon Sep 17 00:00:00 2001 From: zwj Date: Sun, 23 Apr 2023 16:01:36 +0800 Subject: [PATCH 1/3] Fixed no error report when own address type is rpa_random and no random address setting --- components/bt/host/bluedroid/stack/btm/btm_ble_gap.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c b/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c index 1a5b482be54..573751dbf77 100644 --- a/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c +++ b/components/bt/host/bluedroid/stack/btm/btm_ble_gap.c @@ -1068,7 +1068,18 @@ uint32_t BTM_BleUpdateOwnType(uint8_t *own_bda_type, tBTM_START_ADV_CMPL_CBACK * #else uint32_t BTM_BleUpdateOwnType(uint8_t *own_bda_type, tBTM_START_ADV_CMPL_CBACK *cb) { + if((*own_bda_type == BLE_ADDR_RANDOM) || (*own_bda_type == BLE_ADDR_RANDOM_ID)) { + if((btm_cb.ble_ctr_cb.addr_mgnt_cb.exist_addr_bit & BTM_BLE_GAP_ADDR_BIT_RANDOM) != BTM_BLE_GAP_ADDR_BIT_RANDOM) { + BTM_TRACE_ERROR("No random address yet, please set random address and try\n"); + if(cb) { + (* cb)(HCI_ERR_ESP_VENDOR_FAIL); + } + return BTM_ILLEGAL_VALUE; + } + } + btm_cb.ble_ctr_cb.addr_mgnt_cb.own_addr_type = *own_bda_type; + return BTM_SUCCESS; } #endif From 16696d98c18f9681666443a3d610b3fcf315f1f7 Mon Sep 17 00:00:00 2001 From: zhiweijian Date: Sun, 23 Apr 2023 11:15:57 +0800 Subject: [PATCH 2/3] Fixed battery profile wrong condition --- .../btc/profile/std/battery/battery_prf.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/components/bt/host/bluedroid/btc/profile/std/battery/battery_prf.c b/components/bt/host/bluedroid/btc/profile/std/battery/battery_prf.c index 6f5a09d6df4..0a01fd6b3de 100644 --- a/components/bt/host/bluedroid/btc/profile/std/battery/battery_prf.c +++ b/components/bt/host/bluedroid/btc/profile/std/battery/battery_prf.c @@ -104,12 +104,13 @@ static void bas_gatts_callback(esp_gatts_evt_t event, tBTA_GATTS *p_data) p_data->add_result.char_uuid.uu.uuid16); UINT16 char_uuid = p_data->add_result.char_uuid.uu.uuid16; UINT16 service_id = p_data->add_result.service_id; - if (char_uuid == GATT_UUID_BATTERY_LEVEL) { - bas_AddCharDescr(service_id, p_data->add_result.attr_id); - } - if (char_uuid == GATT_UUID_SYSTEM_ID | GATT_UUID_MODEL_NUMBER_STR | GATT_UUID_PNP_ID | - GATT_UUID_SERIAL_NUMBER_STR | GATT_UUID_FW_VERSION_STR | GATT_UUID_HW_VERSION_STR | - GATT_UUID_SW_VERSION_STR | GATT_UUID_MANU_NAME | GATT_UUID_IEEE_DATA) { + UINT16 uuid_len = p_data->add_result.char_uuid.len; + + if (uuid_len == ESP_UUID_LEN_16) { + if (char_uuid == GATT_UUID_BATTERY_LEVEL) { + bas_AddCharDescr(service_id, p_data->add_result.attr_id); + } + switch (char_uuid) { case GATT_UUID_SYSTEM_ID: dis_cb.dis_attr[0].handle = service_id; break; @@ -130,6 +131,8 @@ static void bas_gatts_callback(esp_gatts_evt_t event, tBTA_GATTS *p_data) case GATT_UUID_PNP_ID: dis_cb.dis_attr[8].handle = service_id; break; } + default: + break; } } break; From 24cc2d714e05522e7c2fdc6a207017748c469099 Mon Sep 17 00:00:00 2001 From: zhiweijian Date: Wed, 26 Apr 2023 11:20:09 +0800 Subject: [PATCH 3/3] Fixed BLE disconnection failure on ESP32 --- components/bt/controller/lib_esp32 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/bt/controller/lib_esp32 b/components/bt/controller/lib_esp32 index df2d212f9cd..26b2361bf75 160000 --- a/components/bt/controller/lib_esp32 +++ b/components/bt/controller/lib_esp32 @@ -1 +1 @@ -Subproject commit df2d212f9cd566e6d86e6e6fcb0d02d6ea3b044a +Subproject commit 26b2361bf7569eb46b68eebdf9f634ef4ed17660