1
0
mirror of https://github.com/bluekitchen/btstack.git synced 2025-03-05 13:13:27 +00:00

hci_dump: use hci_dump_posix_fs with PacketLogger format in all posix ports

This commit is contained in:
Matthias Ringwald 2021-03-09 16:39:03 +01:00
parent e51d966a3d
commit 7435ec7b56
35 changed files with 119 additions and 61 deletions
platform/daemon/src
port
daemon/src
libusb-intel
libusb
mtk
posix-h4-atwilc3000
posix-h4-da14581
posix-h4-da14585
posix-h4-zephyr
posix-h4
posix-h5
qt-h4
qt-usb
raspi
windows-h4-da14585
windows-h4-zephyr
windows-h4
windows-winusb-intel
windows-winusb

@ -89,6 +89,8 @@
#include "hci.h" #include "hci.h"
#include "hci_cmd.h" #include "hci_cmd.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "hci_dump_posix_stdout.h"
#include "hci_transport.h" #include "hci_transport.h"
#include "l2cap.h" #include "l2cap.h"
#include "rfcomm_service_db.h" #include "rfcomm_service_db.h"
@ -1392,24 +1394,27 @@ static int daemon_client_handler(connection_t *connection, uint16_t packet_type,
static void daemon_set_logging_enabled(int enabled){ static void daemon_set_logging_enabled(int enabled){
if (enabled && !loggingEnabled){ if (enabled && !loggingEnabled){
// construct path to log file // construct path to log file
const hci_dump_t * hci_dump_impl;
switch (BTSTACK_LOG_TYPE){ switch (BTSTACK_LOG_TYPE){
case HCI_DUMP_STDOUT:
snprintf(string_buffer, sizeof(string_buffer), "stdout");
break;
case HCI_DUMP_PACKETLOGGER: case HCI_DUMP_PACKETLOGGER:
hci_dump_impl = hci_dump_posix_fs_get_instance();
snprintf(string_buffer, sizeof(string_buffer), "%s/hci_dump.pklg", btstack_server_storage_path); snprintf(string_buffer, sizeof(string_buffer), "%s/hci_dump.pklg", btstack_server_storage_path);
hci_dump_posix_fs_open(string_buffer, HCI_DUMP_PACKETLOGGER);
break; break;
case HCI_DUMP_BLUEZ: case HCI_DUMP_BLUEZ:
hci_dump_impl = hci_dump_posix_fs_get_instance();
snprintf(string_buffer, sizeof(string_buffer), "%s/hci_dump.snoop", btstack_server_storage_path); snprintf(string_buffer, sizeof(string_buffer), "%s/hci_dump.snoop", btstack_server_storage_path);
hci_dump_posix_fs_open(string_buffer, HCI_DUMP_BLUEZ);
break; break;
default: default:
break; break;
} }
// hci_dump_open(string_buffer, BTSTACK_LOG_TYPE); hci_dump_init(hci_dump_impl);
printf("Logging to %s\n", string_buffer); printf("Logging to %s\n", string_buffer);
} }
if (!enabled && loggingEnabled){ if (!enabled && loggingEnabled){
// hci_dump_close(); hci_dump_posix_fs_close();
hci_dump_init(NULL);
} }
loggingEnabled = enabled; loggingEnabled = enabled;
} }

@ -67,6 +67,8 @@ BTdaemon_SOURCES = \
gatt_client.o \ gatt_client.o \
hci.o \ hci.o \
hci_dump.o \ hci_dump.o \
hci_dump_posix_fs.o \
hci_dump_posix_stdout.o \
hci_transport_h4.o \ hci_transport_h4.o \
l2cap.o \ l2cap.o \
l2cap_signaling.o \ l2cap_signaling.o \

@ -1,7 +1,7 @@
# Makefile for libusb based examples # Makefile for libusb based examples
BTSTACK_ROOT ?= ../.. BTSTACK_ROOT ?= ../..
CORE += main.c btstack_stdin_posix.c btstack_tlv_posix.c CORE += main.c btstack_stdin_posix.c btstack_tlv_posix.c hci_dump_posix_fs.c
COMMON += hci_transport_h2_libusb.c btstack_run_loop_posix.c le_device_db_tlv.c btstack_link_key_db_tlv.c wav_util.c btstack_network_posix.c COMMON += hci_transport_h2_libusb.c btstack_run_loop_posix.c le_device_db_tlv.c btstack_link_key_db_tlv.c wav_util.c btstack_network_posix.c
COMMON += btstack_audio_portaudio.c btstack_chipset_intel_firmware.c rijndael.c COMMON += btstack_audio_portaudio.c btstack_chipset_intel_firmware.c rijndael.c

@ -61,6 +61,7 @@
#include "hal_led.h" #include "hal_led.h"
#include "hci.h" #include "hci.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h" #include "btstack_stdin.h"
#include "btstack_audio.h" #include "btstack_audio.h"
#include "btstack_tlv_posix.h" #include "btstack_tlv_posix.h"
@ -196,8 +197,10 @@ int main(int argc, const char * argv[]){
strcat(pklg_path, usb_path_string); strcat(pklg_path, usb_path_string);
} }
strcat(pklg_path, ".pklg"); strcat(pklg_path, ".pklg");
hci_dump_posix_fs_open(pklg_path, HCI_DUMP_PACKETLOGGER);
const hci_dump_t * hci_dump_impl = hci_dump_posix_fs_get_instance();
hci_dump_init(hci_dump_impl);
printf("Packet Log: %s\n", pklg_path); printf("Packet Log: %s\n", pklg_path);
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER);
// setup USB Transport // setup USB Transport
transport = hci_transport_usb_instance(); transport = hci_transport_usb_instance();

@ -1,7 +1,7 @@
# Makefile for libusb based examples # Makefile for libusb based examples
BTSTACK_ROOT ?= ../.. BTSTACK_ROOT ?= ../..
CORE += main.c btstack_stdin_posix.c btstack_tlv_posix.c CORE += main.c btstack_stdin_posix.c btstack_tlv_posix.c hci_dump_posix_fs.c
COMMON += hci_transport_h2_libusb.c btstack_run_loop_posix.c le_device_db_tlv.c btstack_link_key_db_tlv.c wav_util.c btstack_network_posix.c COMMON += hci_transport_h2_libusb.c btstack_run_loop_posix.c le_device_db_tlv.c btstack_link_key_db_tlv.c wav_util.c btstack_network_posix.c
COMMON += btstack_audio_portaudio.c btstack_chipset_zephyr.c rijndael.c COMMON += btstack_audio_portaudio.c btstack_chipset_zephyr.c rijndael.c

@ -62,6 +62,7 @@
#include "hal_led.h" #include "hal_led.h"
#include "hci.h" #include "hci.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h" #include "btstack_stdin.h"
#include "btstack_audio.h" #include "btstack_audio.h"
#include "btstack_tlv_posix.h" #include "btstack_tlv_posix.h"
@ -211,8 +212,7 @@ int main(int argc, const char * argv[]){
hci_transport_usb_set_path(usb_path_len, usb_path); hci_transport_usb_set_path(usb_path_len, usb_path);
} }
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT // log into file using HCI_DUMP_PACKETLOGGER format
char pklg_path[100]; char pklg_path[100];
strcpy(pklg_path, "/tmp/hci_dump"); strcpy(pklg_path, "/tmp/hci_dump");
if (usb_path_len){ if (usb_path_len){
@ -220,8 +220,10 @@ int main(int argc, const char * argv[]){
strcat(pklg_path, usb_path_string); strcat(pklg_path, usb_path_string);
} }
strcat(pklg_path, ".pklg"); strcat(pklg_path, ".pklg");
hci_dump_posix_fs_open(pklg_path, HCI_DUMP_PACKETLOGGER);
const hci_dump_t * hci_dump_impl = hci_dump_posix_fs_get_instance();
hci_dump_init(hci_dump_impl);
printf("Packet Log: %s\n", pklg_path); printf("Packet Log: %s\n", pklg_path);
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER);
// init HCI // init HCI
hci_init(hci_transport_usb_instance(), NULL); hci_init(hci_transport_usb_instance(), NULL);

@ -37,6 +37,7 @@ libBTstack_OBJS = \
hci_cmd.o \ hci_cmd.o \
daemon_cmds.o \ daemon_cmds.o \
hci_dump.o \ hci_dump.o \
hci_dump_posix_fs.o \
sdp_util.o \ sdp_util.o \
spp_server.o \ spp_server.o \
socket_connection.o \ socket_connection.o \

@ -6,6 +6,7 @@ CORE += \
btstack_run_loop_posix.c \ btstack_run_loop_posix.c \
btstack_tlv_posix.c \ btstack_tlv_posix.c \
btstack_uart_posix.c \ btstack_uart_posix.c \
hci_dump_posix_fs.c \
hci_transport_h4.c \ hci_transport_h4.c \
le_device_db_tlv.c \ le_device_db_tlv.c \
main.c \ main.c \

@ -61,6 +61,7 @@
#include "btstack_uart.h" #include "btstack_uart.h"
#include "hci.h" #include "hci.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h" #include "btstack_stdin.h"
#include "btstack_tlv_posix.h" #include "btstack_tlv_posix.h"
@ -167,10 +168,12 @@ int main(int argc, const char * argv[]){
/// GET STARTED with BTstack /// /// GET STARTED with BTstack ///
btstack_memory_init(); btstack_memory_init();
btstack_run_loop_init(btstack_run_loop_posix_get_instance()); btstack_run_loop_init(btstack_run_loop_posix_get_instance());
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT // log into file using HCI_DUMP_PACKETLOGGER format
const char * pklg_path = "/tmp/hci_dump.pklg"; const char * pklg_path = "/tmp/hci_dump.pklg";
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER); hci_dump_posix_fs_open(pklg_path, HCI_DUMP_PACKETLOGGER);
const hci_dump_t * hci_dump_impl = hci_dump_posix_fs_get_instance();
hci_dump_init(hci_dump_impl);
printf("Packet Log: %s\n", pklg_path); printf("Packet Log: %s\n", pklg_path);
// pick serial port and configure uart block driver // pick serial port and configure uart block driver

@ -7,6 +7,7 @@ CORE += \
btstack_run_loop_posix.c \ btstack_run_loop_posix.c \
btstack_tlv_posix.c \ btstack_tlv_posix.c \
btstack_uart_posix.c \ btstack_uart_posix.c \
hci_dump_posix_fs.c \
hci_transport_h4.c \ hci_transport_h4.c \
le_device_db_tlv.c \ le_device_db_tlv.c \
main.c \ main.c \

@ -60,6 +60,7 @@
#include "ble/le_device_db_tlv.h" #include "ble/le_device_db_tlv.h"
#include "hci.h" #include "hci.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h" #include "btstack_stdin.h"
#include "btstack_tlv_posix.h" #include "btstack_tlv_posix.h"
@ -162,10 +163,12 @@ int main(int argc, const char * argv[]){
/// GET STARTED with BTstack /// /// GET STARTED with BTstack ///
btstack_memory_init(); btstack_memory_init();
btstack_run_loop_init(btstack_run_loop_posix_get_instance()); btstack_run_loop_init(btstack_run_loop_posix_get_instance());
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT // log into file using HCI_DUMP_PACKETLOGGER format
const char * pklg_path = "/tmp/hci_dump.pklg"; const char * pklg_path = "/tmp/hci_dump.pklg";
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER); hci_dump_posix_fs_open(pklg_path, HCI_DUMP_PACKETLOGGER);
const hci_dump_t * hci_dump_impl = hci_dump_posix_fs_get_instance();
hci_dump_init(hci_dump_impl);
printf("Packet Log: %s\n", pklg_path); printf("Packet Log: %s\n", pklg_path);
// pick serial port and configure uart block driver // pick serial port and configure uart block driver

@ -6,6 +6,7 @@ CORE += \
btstack_run_loop_posix.c \ btstack_run_loop_posix.c \
btstack_tlv_posix.c \ btstack_tlv_posix.c \
btstack_uart_posix.c \ btstack_uart_posix.c \
hci_dump_posix_fs.c \
hci_transport_h4.c \ hci_transport_h4.c \
le_device_db_tlv.c \ le_device_db_tlv.c \
main.c \ main.c \

@ -60,6 +60,7 @@
#include "ble/le_device_db_tlv.h" #include "ble/le_device_db_tlv.h"
#include "hci.h" #include "hci.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h" #include "btstack_stdin.h"
#include "btstack_tlv_posix.h" #include "btstack_tlv_posix.h"
@ -162,10 +163,12 @@ int main(int argc, const char * argv[]){
/// GET STARTED with BTstack /// /// GET STARTED with BTstack ///
btstack_memory_init(); btstack_memory_init();
btstack_run_loop_init(btstack_run_loop_posix_get_instance()); btstack_run_loop_init(btstack_run_loop_posix_get_instance());
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT // log into file using HCI_DUMP_PACKETLOGGER format
const char * pklg_path = "/tmp/hci_dump.pklg"; const char * pklg_path = "/tmp/hci_dump.pklg";
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER); hci_dump_posix_fs_open(pklg_path, HCI_DUMP_PACKETLOGGER);
const hci_dump_t * hci_dump_impl = hci_dump_posix_fs_get_instance();
hci_dump_init(hci_dump_impl);
printf("Packet Log: %s\n", pklg_path); printf("Packet Log: %s\n", pklg_path);
// pick serial port and configure uart block driver // pick serial port and configure uart block driver

@ -5,6 +5,7 @@ CORE += \
btstack_run_loop_posix.c \ btstack_run_loop_posix.c \
btstack_tlv_posix.c \ btstack_tlv_posix.c \
btstack_uart_posix.c \ btstack_uart_posix.c \
hci_dump_posix_fs.c \
hci_transport_h4.c \ hci_transport_h4.c \
le_device_db_tlv.c \ le_device_db_tlv.c \
main.c \ main.c \

@ -61,6 +61,7 @@
#include "ble/le_device_db_tlv.h" #include "ble/le_device_db_tlv.h"
#include "hci.h" #include "hci.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h" #include "btstack_stdin.h"
#include "btstack_chipset_zephyr.h" #include "btstack_chipset_zephyr.h"
#include "btstack_tlv_posix.h" #include "btstack_tlv_posix.h"
@ -138,10 +139,12 @@ int main(int argc, const char * argv[]){
/// GET STARTED with BTstack /// /// GET STARTED with BTstack ///
btstack_memory_init(); btstack_memory_init();
btstack_run_loop_init(btstack_run_loop_posix_get_instance()); btstack_run_loop_init(btstack_run_loop_posix_get_instance());
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT // log into file using HCI_DUMP_PACKETLOGGER format
const char * pklg_path = "/tmp/hci_dump.pklg"; const char * pklg_path = "/tmp/hci_dump.pklg";
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER); hci_dump_posix_fs_open(pklg_path, HCI_DUMP_PACKETLOGGER);
const hci_dump_t * hci_dump_impl = hci_dump_posix_fs_get_instance();
hci_dump_init(hci_dump_impl);
printf("Packet Log: %s\n", pklg_path); printf("Packet Log: %s\n", pklg_path);
// pick serial port // pick serial port

@ -15,6 +15,7 @@ CORE += \
btstack_audio_portaudio.c \ btstack_audio_portaudio.c \
btstack_tlv_posix.c \ btstack_tlv_posix.c \
btstack_uart_posix.c \ btstack_uart_posix.c \
hci_dump_posix_fs.c \
hci_transport_h4.c \ hci_transport_h4.c \
le_device_db_tlv.c \ le_device_db_tlv.c \
rijndael.c \ rijndael.c \

@ -63,6 +63,7 @@
#include "bluetooth_company_id.h" #include "bluetooth_company_id.h"
#include "hci.h" #include "hci.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h" #include "btstack_stdin.h"
#include "btstack_tlv_posix.h" #include "btstack_tlv_posix.h"
@ -240,9 +241,11 @@ int main(int argc, const char * argv[]){
btstack_memory_init(); btstack_memory_init();
btstack_run_loop_init(btstack_run_loop_posix_get_instance()); btstack_run_loop_init(btstack_run_loop_posix_get_instance());
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT // log into file using HCI_DUMP_PACKETLOGGER format
const char * pklg_path = "/tmp/hci_dump.pklg"; const char * pklg_path = "/tmp/hci_dump.pklg";
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER); hci_dump_posix_fs_open(pklg_path, HCI_DUMP_PACKETLOGGER);
const hci_dump_t * hci_dump_impl = hci_dump_posix_fs_get_instance();
hci_dump_init(hci_dump_impl);
printf("Packet Log: %s\n", pklg_path); printf("Packet Log: %s\n", pklg_path);
// pick serial port // pick serial port

@ -13,6 +13,7 @@ CORE += \
btstack_tlv_posix.c \ btstack_tlv_posix.c \
btstack_uart_posix.c \ btstack_uart_posix.c \
btstack_slip.c \ btstack_slip.c \
hci_dump_posix_fs.c \
hci_transport_h5.c \ hci_transport_h5.c \
le_device_db_tlv.c \ le_device_db_tlv.c \
main.c \ main.c \

@ -61,6 +61,7 @@
#include "bluetooth_company_id.h" #include "bluetooth_company_id.h"
#include "hci.h" #include "hci.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h" #include "btstack_stdin.h"
#include "btstack_tlv_posix.h" #include "btstack_tlv_posix.h"
#include "btstack_uart.h" #include "btstack_uart.h"
@ -201,10 +202,12 @@ int main(int argc, const char * argv[]){
/// GET STARTED with BTstack /// /// GET STARTED with BTstack ///
btstack_memory_init(); btstack_memory_init();
btstack_run_loop_init(btstack_run_loop_posix_get_instance()); btstack_run_loop_init(btstack_run_loop_posix_get_instance());
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT // log into file using HCI_DUMP_PACKETLOGGER format
const char * pklg_path = "/tmp/hci_dump.pklg"; const char * pklg_path = "/tmp/hci_dump.pklg";
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER); hci_dump_posix_fs_open(pklg_path, HCI_DUMP_PACKETLOGGER);
const hci_dump_t * hci_dump_impl = hci_dump_posix_fs_get_instance();
hci_dump_init(hci_dump_impl);
printf("Packet Log: %s\n", pklg_path); printf("Packet Log: %s\n", pklg_path);
// pick serial port // pick serial port

@ -59,6 +59,7 @@ file(GLOB SOURCES_RIJNDAEL "${BTSTACK_ROOT}/3rd-party/rijndael/rijndael.c")
set(SOURCES_POSIX set(SOURCES_POSIX
${BTSTACK_ROOT}/platform/posix/btstack_audio_portaudio.c ${BTSTACK_ROOT}/platform/posix/btstack_audio_portaudio.c
${BTSTACK_ROOT}/platform/posix/btstack_tlv_posix.c ${BTSTACK_ROOT}/platform/posix/btstack_tlv_posix.c
${BTSTACK_ROOT}/platform/posix/hci_dump_posix_fs.c
${BTSTACK_ROOT}/platform/posix/wav_util.c ${BTSTACK_ROOT}/platform/posix/wav_util.c
) )

@ -65,6 +65,7 @@
#include "hal_led.h" #include "hal_led.h"
#include "hci.h" #include "hci.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h" #include "btstack_stdin.h"
#include "btstack_audio.h" #include "btstack_audio.h"
#include "btstack_tlv_posix.h" #include "btstack_tlv_posix.h"
@ -238,15 +239,17 @@ int main(int argc, char * argv[]){
btstack_memory_init(); btstack_memory_init();
btstack_run_loop_init(btstack_run_loop_qt_get_instance()); btstack_run_loop_init(btstack_run_loop_qt_get_instance());
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT // log into file using HCI_DUMP_PACKETLOGGER format
char pklg_path[100]; char pklg_path[100];
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
strcpy(pklg_path, "hci_dump.pklg"); strcpy(pklg_path, "hci_dump.pklg");
#else #else
strcpy(pklg_path, "/tmp/hci_dump.pklg"); strcpy(pklg_path, "/tmp/hci_dump.pklg");
#endif #endif
hci_dump_posix_fs_open(pklg_path, HCI_DUMP_PACKETLOGGER);
const hci_dump_t * hci_dump_impl = hci_dump_posix_fs_get_instance();
hci_dump_init(hci_dump_impl);
printf("Packet Log: %s\n", pklg_path); printf("Packet Log: %s\n", pklg_path);
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER);
// init HCI // init HCI
#ifdef Q_OS_WIN #ifdef Q_OS_WIN

@ -56,6 +56,7 @@ file(GLOB SOURCES_RIJNDAEL "${BTSTACK_ROOT}/3rd-party/rijndael/rijndael.c")
set(SOURCES_POSIX set(SOURCES_POSIX
${BTSTACK_ROOT}/platform/posix/btstack_audio_portaudio.c ${BTSTACK_ROOT}/platform/posix/btstack_audio_portaudio.c
${BTSTACK_ROOT}/platform/posix/btstack_tlv_posix.c ${BTSTACK_ROOT}/platform/posix/btstack_tlv_posix.c
${BTSTACK_ROOT}/platform/posix/hci_dump_posix_fs.c
${BTSTACK_ROOT}/platform/posix/wav_util.c ${BTSTACK_ROOT}/platform/posix/wav_util.c
) )

@ -64,6 +64,7 @@
#include "hal_led.h" #include "hal_led.h"
#include "hci.h" #include "hci.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h" #include "btstack_stdin.h"
#include "btstack_audio.h" #include "btstack_audio.h"
#include "btstack_tlv_posix.h" #include "btstack_tlv_posix.h"
@ -209,8 +210,7 @@ int main(int argc, char * argv[]){
} }
#endif #endif
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT // log into file using HCI_DUMP_PACKETLOGGER format
char pklg_path[100]; char pklg_path[100];
#ifdef __WIN32 #ifdef __WIN32
strcpy(pklg_path, "hci_dump"); strcpy(pklg_path, "hci_dump");
@ -222,8 +222,10 @@ int main(int argc, char * argv[]){
} }
#endif #endif
strcat(pklg_path, ".pklg"); strcat(pklg_path, ".pklg");
hci_dump_posix_fs_open(pklg_path, HCI_DUMP_PACKETLOGGER);
const hci_dump_t * hci_dump_impl = hci_dump_posix_fs_get_instance();
hci_dump_init(hci_dump_impl);
printf("Packet Log: %s\n", pklg_path); printf("Packet Log: %s\n", pklg_path);
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER);
// init HCI // init HCI
#if 1 #if 1

@ -10,6 +10,7 @@ CORE += \
btstack_tlv_posix.c \ btstack_tlv_posix.c \
btstack_uart_posix.c \ btstack_uart_posix.c \
btstack_slip.c \ btstack_slip.c \
hci_dump_posix_fs.c \
hci_transport_h4.c \ hci_transport_h4.c \
hci_transport_h5.c \ hci_transport_h5.c \
le_device_db_tlv.c \ le_device_db_tlv.c \

@ -67,6 +67,7 @@
#include "bluetooth_company_id.h" #include "bluetooth_company_id.h"
#include "hci.h" #include "hci.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h" #include "btstack_stdin.h"
#include "btstack_tlv_posix.h" #include "btstack_tlv_posix.h"
#include "btstack_uart.h" #include "btstack_uart.h"
@ -300,9 +301,11 @@ int main(int argc, const char * argv[]){
/// GET STARTED with BTstack /// /// GET STARTED with BTstack ///
btstack_memory_init(); btstack_memory_init();
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT // log into file using HCI_DUMP_PACKETLOGGER format
const char * pklg_path = "/tmp/hci_dump.pklg"; const char * pklg_path = "/tmp/hci_dump.pklg";
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER); hci_dump_posix_fs_open(pklg_path, HCI_DUMP_PACKETLOGGER);
const hci_dump_t * hci_dump_impl = hci_dump_posix_fs_get_instance();
hci_dump_init(hci_dump_impl);
printf("Packet Log: %s\n", pklg_path); printf("Packet Log: %s\n", pklg_path);
// setup run loop // setup run loop

@ -1,7 +1,7 @@
# Makefile for windows-h4-da14585 examples # Makefile for windows-h4-da14585 examples
BTSTACK_ROOT ?= ../.. BTSTACK_ROOT ?= ../..
CORE += main.c btstack_stdin_windows.c btstack_tlv_posix.c CORE += main.c btstack_stdin_windows.c btstack_tlv_posix.c hci_dump_posix_fs.c
COMMON += \ COMMON += \
btstack_run_loop_windows.c \ btstack_run_loop_windows.c \

@ -59,6 +59,7 @@
#include "ble/le_device_db_tlv.h" #include "ble/le_device_db_tlv.h"
#include "hci.h" #include "hci.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h" #include "btstack_stdin.h"
#include "btstack_tlv_posix.h" #include "btstack_tlv_posix.h"
#include "hal_led.h" #include "hal_led.h"
@ -162,9 +163,11 @@ int main(int argc, const char * argv[]){
btstack_memory_init(); btstack_memory_init();
btstack_run_loop_init(btstack_run_loop_windows_get_instance()); btstack_run_loop_init(btstack_run_loop_windows_get_instance());
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT // log into file using HCI_DUMP_PACKETLOGGER format
const char * pklg_path = "hci_dump.pklg"; const char * pklg_path = "/tmp/hci_dump.pklg";
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER); hci_dump_posix_fs_open(pklg_path, HCI_DUMP_PACKETLOGGER);
const hci_dump_t * hci_dump_impl = hci_dump_posix_fs_get_instance();
hci_dump_init(hci_dump_impl);
printf("Packet Log: %s\n", pklg_path); printf("Packet Log: %s\n", pklg_path);
// pick serial port and configure uart block driver // pick serial port and configure uart block driver

@ -1,7 +1,7 @@
# Makefile for windows-h4 examples # Makefile for windows-h4 examples
BTSTACK_ROOT ?= ../.. BTSTACK_ROOT ?= ../..
CORE += main.c btstack_stdin_windows.c btstack_tlv_posix.c CORE += main.c btstack_stdin_windows.c btstack_tlv_posix.c hci_dump_posix_fs.c
COMMON += \ COMMON += \
btstack_chipset_zephyr.c \ btstack_chipset_zephyr.c \

@ -59,6 +59,7 @@
#include "bluetooth_company_id.h" #include "bluetooth_company_id.h"
#include "hci.h" #include "hci.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h" #include "btstack_stdin.h"
#include "btstack_chipset_zephyr.h" #include "btstack_chipset_zephyr.h"
#include "hal_led.h" #include "hal_led.h"
@ -141,9 +142,11 @@ int main(int argc, const char * argv[]){
btstack_memory_init(); btstack_memory_init();
btstack_run_loop_init(btstack_run_loop_windows_get_instance()); btstack_run_loop_init(btstack_run_loop_windows_get_instance());
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT // log into file using HCI_DUMP_PACKETLOGGER format
const char * pklg_path = "hci_dump.pklg"; const char * pklg_path = "/tmp/hci_dump.pklg";
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER); hci_dump_posix_fs_open(pklg_path, HCI_DUMP_PACKETLOGGER);
const hci_dump_t * hci_dump_impl = hci_dump_posix_fs_get_instance();
hci_dump_init(hci_dump_impl);
printf("Packet Log: %s\n", pklg_path); printf("Packet Log: %s\n", pklg_path);
// pick serial port // pick serial port

@ -1,7 +1,7 @@
# Makefile for windows-h4 examples # Makefile for windows-h4 examples
BTSTACK_ROOT ?= ../.. BTSTACK_ROOT ?= ../..
CORE += main.c btstack_stdin_windows.c btstack_tlv_posix.c CORE += main.c btstack_stdin_windows.c btstack_tlv_posix.c hci_dump_posix_fs.c
COMMON += \ COMMON += \
btstack_run_loop_windows.c \ btstack_run_loop_windows.c \

@ -53,6 +53,7 @@
#include "btstack_run_loop_windows.h" #include "btstack_run_loop_windows.h"
#include "hci.h" #include "hci.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "hal_led.h" #include "hal_led.h"
#include "btstack_tlv_posix.h" #include "btstack_tlv_posix.h"
#include "ble/le_device_db_tlv.h" #include "ble/le_device_db_tlv.h"
@ -226,7 +227,12 @@ int main(int argc, const char * argv[]){
btstack_memory_init(); btstack_memory_init();
btstack_run_loop_init(btstack_run_loop_windows_get_instance()); btstack_run_loop_init(btstack_run_loop_windows_get_instance());
// hci_dump_open("hci_dump.pklg", HCI_DUMP_PACKETLOGGER); // log into file using HCI_DUMP_PACKETLOGGER format
const char * pklg_path = "/tmp/hci_dump.pklg";
hci_dump_posix_fs_open(pklg_path, HCI_DUMP_PACKETLOGGER);
const hci_dump_t * hci_dump_impl = hci_dump_posix_fs_get_instance();
hci_dump_init(hci_dump_impl);
printf("Packet Log: %s\n", pklg_path);
// pick serial port // pick serial port
config.device_name = "\\\\.\\COM7"; config.device_name = "\\\\.\\COM7";

@ -1,7 +1,7 @@
# Makefile for windows WinUSB based examples # Makefile for windows WinUSB based examples
BTSTACK_ROOT ?= ../.. BTSTACK_ROOT ?= ../..
CORE += main.c btstack_stdin_windows.c btstack_tlv_posix.c CORE += main.c btstack_stdin_windows.c btstack_tlv_posix.c hci_dump_posix_fs.c
COMMON += hci_transport_h2_winusb.c btstack_run_loop_windows.c le_device_db_tlv.c btstack_link_key_db_tlv.c wav_util.c COMMON += hci_transport_h2_winusb.c btstack_run_loop_windows.c le_device_db_tlv.c btstack_link_key_db_tlv.c wav_util.c
COMMON += btstack_chipset_intel_firmware.c rijndael.c COMMON += btstack_chipset_intel_firmware.c rijndael.c

@ -62,6 +62,7 @@
#include "hal_led.h" #include "hal_led.h"
#include "hci.h" #include "hci.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h" #include "btstack_stdin.h"
#include "btstack_chipset_intel_firmware.h" #include "btstack_chipset_intel_firmware.h"
@ -155,18 +156,13 @@ int main(int argc, const char * argv[]){
/// GET STARTED with BTstack /// /// GET STARTED with BTstack ///
btstack_memory_init(); btstack_memory_init();
btstack_run_loop_init(btstack_run_loop_windows_get_instance()); btstack_run_loop_init(btstack_run_loop_windows_get_instance());
// if (usb_path_len){
// hci_transport_usb_set_path(usb_path_len, usb_path);
// }
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT // log into file using HCI_DUMP_PACKETLOGGER format
const char * pklg_path = "/tmp/hci_dump.pklg";
char pklg_path[100]; hci_dump_posix_fs_open(pklg_path, HCI_DUMP_PACKETLOGGER);
strcpy(pklg_path, "hci_dump"); const hci_dump_t * hci_dump_impl = hci_dump_posix_fs_get_instance();
strcat(pklg_path, ".pklg"); hci_dump_init(hci_dump_impl);
printf("Packet Log: %s\n", pklg_path); printf("Packet Log: %s\n", pklg_path);
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER);
// handle CTRL-c // handle CTRL-c
signal(SIGINT, sigint_handler); signal(SIGINT, sigint_handler);

@ -1,7 +1,7 @@
# Makefile for windows WinUSB based examples # Makefile for windows WinUSB based examples
BTSTACK_ROOT ?= ../.. BTSTACK_ROOT ?= ../..
CORE += main.c btstack_stdin_windows.c btstack_tlv_posix.c CORE += main.c btstack_stdin_windows.c btstack_tlv_posix.c hci_dump_posix_fs.c
COMMON += hci_transport_h2_winusb.c btstack_run_loop_windows.c le_device_db_tlv.c btstack_link_key_db_tlv.c wav_util.c COMMON += hci_transport_h2_winusb.c btstack_run_loop_windows.c le_device_db_tlv.c btstack_link_key_db_tlv.c wav_util.c
COMMON += rijndael.c COMMON += rijndael.c

@ -62,6 +62,7 @@
#include "hal_led.h" #include "hal_led.h"
#include "hci.h" #include "hci.h"
#include "hci_dump.h" #include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h" #include "btstack_stdin.h"
int btstack_main(int argc, const char * argv[]); int btstack_main(int argc, const char * argv[]);
@ -128,11 +129,12 @@ int main(int argc, const char * argv[]){
btstack_memory_init(); btstack_memory_init();
btstack_run_loop_init(btstack_run_loop_windows_get_instance()); btstack_run_loop_init(btstack_run_loop_windows_get_instance());
char pklg_path[100]; // log into file using HCI_DUMP_PACKETLOGGER format
strcpy(pklg_path, "hci_dump"); const char * pklg_path = "/tmp/hci_dump.pklg";
strcat(pklg_path, ".pklg"); hci_dump_posix_fs_open(pklg_path, HCI_DUMP_PACKETLOGGER);
const hci_dump_t * hci_dump_impl = hci_dump_posix_fs_get_instance();
hci_dump_init(hci_dump_impl);
printf("Packet Log: %s\n", pklg_path); printf("Packet Log: %s\n", pklg_path);
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER);
// init HCI // init HCI
hci_init(hci_transport_usb_instance(), NULL); hci_init(hci_transport_usb_instance(), NULL);