From bb2b2d34ca5cc012de1809baf80fbec6e9ee82fb Mon Sep 17 00:00:00 2001 From: Zhou Xiao Date: Mon, 22 Dec 2025 17:05:34 +0800 Subject: [PATCH] feat(ble): supported ble log v2 hci log for Bluedroid host --- components/bt/host/bluedroid/api/esp_bluedroid_hci.c | 6 ++++++ components/bt/host/bluedroid/hci/hci_hal_h4.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/components/bt/host/bluedroid/api/esp_bluedroid_hci.c b/components/bt/host/bluedroid/api/esp_bluedroid_hci.c index ac64d17d04..4d02016d89 100644 --- a/components/bt/host/bluedroid/api/esp_bluedroid_hci.c +++ b/components/bt/host/bluedroid/api/esp_bluedroid_hci.c @@ -19,6 +19,9 @@ #if CONFIG_BT_BLE_LOG_SPI_OUT_HCI_ENABLED #include "ble_log/ble_log_spi_out.h" #endif // CONFIG_BT_BLE_LOG_SPI_OUT_HCI_ENABLED +#if CONFIG_BLE_LOG_ENABLED +#include "ble_log.h" +#endif /* CONFIG_BLE_LOG_ENABLED */ static esp_bluedroid_hci_driver_operations_t s_hci_driver_ops = { 0 }; @@ -70,6 +73,9 @@ void hci_host_send_packet(uint8_t *data, uint16_t len) #if CONFIG_BT_BLE_LOG_SPI_OUT_HCI_ENABLED ble_log_spi_out_hci_write(BLE_LOG_SPI_OUT_SOURCE_HCI_DOWNSTREAM, data, len); #endif // CONFIG_BT_BLE_LOG_SPI_OUT_HCI_ENABLED +#if CONFIG_BLE_LOG_ENABLED + ble_log_write_hex(BLE_LOG_SRC_HCI, data, len); +#endif /* CONFIG_BLE_LOG_ENABLED */ #if (BT_CONTROLLER_INCLUDED == TRUE) esp_vhci_host_send_packet(data, len); #else /* BT_CONTROLLER_INCLUDED == TRUE */ diff --git a/components/bt/host/bluedroid/hci/hci_hal_h4.c b/components/bt/host/bluedroid/hci/hci_hal_h4.c index 0baa265f2a..76d7960b73 100644 --- a/components/bt/host/bluedroid/hci/hci_hal_h4.c +++ b/components/bt/host/bluedroid/hci/hci_hal_h4.c @@ -45,6 +45,9 @@ #if CONFIG_BT_BLE_LOG_SPI_OUT_HCI_ENABLED #include "ble_log/ble_log_spi_out.h" #endif // CONFIG_BT_BLE_LOG_SPI_OUT_HCI_ENABLED +#if CONFIG_BLE_LOG_ENABLED +#include "ble_log.h" +#endif /* CONFIG_BLE_LOG_ENABLED */ #define HCI_BLE_EVENT 0x3e #define PACKET_TYPE_TO_INBOUND_INDEX(type) ((type) - 2) @@ -605,6 +608,9 @@ static int host_recv_pkt_cb(uint8_t *data, uint16_t len) #if CONFIG_BT_BLE_LOG_SPI_OUT_HCI_ENABLED ble_log_spi_out_hci_write(BLE_LOG_SPI_OUT_SOURCE_HCI_UPSTREAM, data, len); #endif // CONFIG_BT_BLE_LOG_SPI_OUT_HCI_ENABLED +#if CONFIG_BLE_LOG_ENABLED + ble_log_write_hex(BLE_LOG_SRC_HCI, data, len); +#endif /* CONFIG_BLE_LOG_ENABLED */ //Target has packet to host, malloc new buffer for packet BT_HDR *pkt = NULL; #if (BLE_42_SCAN_EN == TRUE)