From 124cce0de3b37c0f42bece719835b84245707eed Mon Sep 17 00:00:00 2001 From: zhanghaipeng Date: Thu, 29 Jun 2023 16:52:55 +0800 Subject: [PATCH 1/2] fix(bt): Fix ble advertising data length 0 error - Fixed an issue where the BLE advertisement length of 0 was causing an error --- components/bt/host/bluedroid/api/esp_gap_ble_api.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/bt/host/bluedroid/api/esp_gap_ble_api.c b/components/bt/host/bluedroid/api/esp_gap_ble_api.c index 2842fe14d26a..57e102d48f4f 100644 --- a/components/bt/host/bluedroid/api/esp_gap_ble_api.c +++ b/components/bt/host/bluedroid/api/esp_gap_ble_api.c @@ -431,8 +431,7 @@ esp_err_t esp_ble_gap_config_adv_data_raw(uint8_t *raw_data, uint32_t raw_data_l ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED); - if (raw_data == NULL - || (raw_data_len <= 0 || raw_data_len > ESP_BLE_ADV_DATA_LEN_MAX)) { + if ((raw_data_len != 0 && raw_data == NULL) || raw_data_len > ESP_BLE_ADV_DATA_LEN_MAX) { return ESP_ERR_INVALID_ARG; } From 2b1269d4fba8ef94f1f4cae21727915cec4701e5 Mon Sep 17 00:00:00 2001 From: zhanghaipeng Date: Mon, 3 Jul 2023 15:36:41 +0800 Subject: [PATCH 2/2] fix(bt): Fix the issue of not printing the Bluetooth MAC address for ESP32 - Add a log statement to print the Bluetooth MAC address --- components/bt/controller/esp32/bt.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/bt/controller/esp32/bt.c b/components/bt/controller/esp32/bt.c index 532d110580a5..ca923f450492 100644 --- a/components/bt/controller/esp32/bt.c +++ b/components/bt/controller/esp32/bt.c @@ -864,7 +864,11 @@ static void *malloc_internal_wrapper(size_t size) static int32_t IRAM_ATTR read_mac_wrapper(uint8_t mac[6]) { - return esp_read_mac(mac, ESP_MAC_BT); + int ret = esp_read_mac(mac, ESP_MAC_BT); + ESP_LOGI(BTDM_LOG_TAG, "Bluetooth MAC: %02x:%02x:%02x:%02x:%02x:%02x", + mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); + + return ret; } static void IRAM_ATTR srand_wrapper(unsigned int seed)