feat(nimble): Add BLE HCI logging support for ESP Insights

fix(nimble): Simplify esp insight ble logging
This commit is contained in:
Mayank Tyagi
2026-03-16 12:56:31 +05:30
parent 301a2847fa
commit 5045cb5eb8
3 changed files with 16 additions and 3 deletions
+7 -1
View File
@@ -845,6 +845,9 @@ ble_hs_rx_data(struct os_mbuf *om, void *arg)
data[0] = 0x02;
os_mbuf_copydata(om, 0, len, &data[1]);
bt_hci_log_record_hci_data(HCI_LOG_DATA_TYPE_C2H_ACL, &data[1], len);
#if BT_HCI_INSIGHTS_INCLUDED
bt_hci_log_record_insights(HCI_LOG_DATA_TYPE_C2H_ACL, &data[1], len);
#endif
}
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
@@ -881,7 +884,10 @@ ble_hs_tx_data(struct os_mbuf *om)
uint8_t data[BLE_HS_HCI_LOG_BUF_SIZE];
data[0] = 0x02;
os_mbuf_copydata(om, 0, pkt_len, &data[1]);
bt_hci_log_record_hci_data(data[0], &data[1], pkt_len);
bt_hci_log_record_hci_data(HCI_LOG_DATA_TYPE_H2C_ACL, &data[1], pkt_len);
#if BT_HCI_INSIGHTS_INCLUDED
bt_hci_log_record_insights(HCI_LOG_DATA_TYPE_H2C_ACL, &data[1], pkt_len);
#endif
}
#endif
+6
View File
@@ -706,8 +706,14 @@ ble_hs_hci_rx_evt(uint8_t *hci_ev, void *arg)
uint16_t len = hci_ev[1] + 3;
if (host_recv_adv_packet(hci_ev)) {
bt_hci_log_record_hci_adv(HCI_LOG_DATA_TYPE_ADV, &hci_ev[1], len - 2);
#if BT_HCI_INSIGHTS_INCLUDED
bt_hci_log_record_insights(HCI_LOG_DATA_TYPE_ADV, &hci_ev[1], len - 2);
#endif
} else {
bt_hci_log_record_hci_data(0x04, &hci_ev[0], len - 1);
#if BT_HCI_INSIGHTS_INCLUDED
bt_hci_log_record_insights(0x04, &hci_ev[0], len - 1);
#endif
}
#endif // #if (BT_HCI_LOG_INCLUDED == TRUE)
+3 -2
View File
@@ -28,8 +28,6 @@
#if (BT_HCI_LOG_INCLUDED == TRUE)
#include "hci_log/bt_hci_log.h"
#endif // (BT_HCI_LOG_INCLUDED == TRUE)
/*
* HCI Command Header
*
@@ -102,6 +100,9 @@ ble_hs_hci_cmd_send(uint16_t opcode, uint8_t len, const void *cmddata)
#if ((BT_HCI_LOG_INCLUDED == TRUE) && SOC_ESP_NIMBLE_CONTROLLER && CONFIG_BT_CONTROLLER_ENABLED)
bt_hci_log_record_hci_data(0x01, (uint8_t *)buf, len + BLE_HCI_CMD_HDR_LEN);
#if BT_HCI_INSIGHTS_INCLUDED
bt_hci_log_record_insights(0x01, (uint8_t *)buf, len + BLE_HCI_CMD_HDR_LEN);
#endif
#endif
rc = ble_hs_hci_cmd_transport((void *) buf);