From c2a34adc0f6d4723e173cbe7530d0fd4e5b9cae3 Mon Sep 17 00:00:00 2001 From: Rahul Tank Date: Wed, 6 Nov 2024 12:34:24 +0530 Subject: [PATCH] fix(nimble): Replace ESP_LOG* with esp_rom_printf in controller context callback --- .../bt/host/nimble/esp-hci/src/esp_nimble_hci.c | 8 ++++---- .../hci/ble_adv_scan_combined/main/app_bt.c | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c b/components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c index 3c21ba90813..9fec7119f16 100644 --- a/components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c +++ b/components/bt/host/nimble/esp-hci/src/esp_nimble_hci.c @@ -163,14 +163,14 @@ static void ble_hci_rx_acl(uint8_t *data, uint16_t len) m = ble_transport_alloc_acl_from_ll(); if (!m) { - ESP_LOGD(TAG,"Failed to allocate buffer, retrying "); + esp_rom_printf("Failed to allocate buffer, retrying "); /* Give some time to free buffer and try again */ vTaskDelay(1); } }while(!m); if ((rc = os_mbuf_append(m, data, len)) != 0) { - ESP_LOGE(TAG, "%s failed to os_mbuf_append; rc = %d", __func__, rc); + esp_rom_printf("%s failed to os_mbuf_append; rc = %d", __func__, rc); os_mbuf_free_chain(m); return; } @@ -223,7 +223,7 @@ static int host_rcv_pkt(uint8_t *data, uint16_t len) if(!ble_hs_enabled_state) { /* If host is not enabled, drop the packet */ - ESP_LOGE(TAG, "Host not enabled. Dropping the packet!"); + esp_rom_printf("Host not enabled. Dropping the packet!"); return 0; } @@ -236,7 +236,7 @@ static int host_rcv_pkt(uint8_t *data, uint16_t len) assert(totlen <= UINT8_MAX + BLE_HCI_EVENT_HDR_LEN); if (totlen > MYNEWT_VAL(BLE_TRANSPORT_EVT_SIZE)) { - ESP_LOGE(TAG, "Received HCI data length at host (%d) exceeds maximum configured HCI event buffer size (%d).", + esp_rom_printf("Received HCI data length at host (%d) exceeds maximum configured HCI event buffer size (%d).", totlen, MYNEWT_VAL(BLE_TRANSPORT_EVT_SIZE)); ble_hs_sched_reset(BLE_HS_ECONTROLLER); return 0; diff --git a/examples/bluetooth/hci/ble_adv_scan_combined/main/app_bt.c b/examples/bluetooth/hci/ble_adv_scan_combined/main/app_bt.c index 0f7aacf7985..1f2a6a83999 100644 --- a/examples/bluetooth/hci/ble_adv_scan_combined/main/app_bt.c +++ b/examples/bluetooth/hci/ble_adv_scan_combined/main/app_bt.c @@ -1,7 +1,7 @@ /* * BLE Combined Advertising and Scanning Example. * - * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -56,27 +56,27 @@ static int host_rcv_pkt(uint8_t *data, uint16_t len) host_rcv_data_t send_data; uint8_t *data_pkt; /* Check second byte for HCI event. If event opcode is 0x0e, the event is - * HCI Command Complete event. Sice we have recieved "0x0e" event, we can + * HCI Command Complete event. Sice we have received "0x0e" event, we can * check for byte 4 for command opcode and byte 6 for it's return status. */ if (data[1] == 0x0e) { if (data[6] == 0) { - ESP_LOGI(TAG, "Event opcode 0x%02x success.", data[4]); + esp_rom_printf("Event opcode 0x%02x success.", data[4]); } else { - ESP_LOGE(TAG, "Event opcode 0x%02x fail with reason: 0x%02x.", data[4], data[6]); + esp_rom_printf("Event opcode 0x%02x fail with reason: 0x%02x.", data[4], data[6]); return ESP_FAIL; } } data_pkt = (uint8_t *)malloc(sizeof(uint8_t) * len); if (data_pkt == NULL) { - ESP_LOGE(TAG, "Malloc data_pkt failed!"); + esp_rom_printf("Malloc data_pkt failed!"); return ESP_FAIL; } memcpy(data_pkt, data, len); send_data.q_data = data_pkt; send_data.q_data_len = len; if (xQueueSend(adv_queue, (void *)&send_data, ( TickType_t ) 0) != pdTRUE) { - ESP_LOGD(TAG, "Failed to enqueue advertising report. Queue full."); + esp_rom_printf("Failed to enqueue advertising report. Queue full."); /* If data sent successfully, then free the pointer in `xQueueReceive' * after processing it. Or else if enqueue in not successful, free it * here. */ @@ -114,7 +114,7 @@ static void hci_cmd_send_ble_scan_params(void) uint16_t scan_window = 0x30; /* 30 ms */ uint8_t own_addr_type = 0x00; /* Public Device Address (default). */ - uint8_t filter_policy = 0x00; /* Accept all packets excpet directed advertising packets (default). */ + uint8_t filter_policy = 0x00; /* Accept all packets except directed advertising packets (default). */ uint16_t sz = make_cmd_ble_set_scan_params(hci_cmd_buf, scan_type, scan_interval, scan_window, own_addr_type, filter_policy); esp_vhci_host_send_packet(hci_cmd_buf, sz); }