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

View File

@ -89,6 +89,8 @@
#include "hci.h"
#include "hci_cmd.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "hci_dump_posix_stdout.h"
#include "hci_transport.h"
#include "l2cap.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){
if (enabled && !loggingEnabled){
// construct path to log file
const hci_dump_t * hci_dump_impl;
switch (BTSTACK_LOG_TYPE){
case HCI_DUMP_STDOUT:
snprintf(string_buffer, sizeof(string_buffer), "stdout");
break;
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);
hci_dump_posix_fs_open(string_buffer, HCI_DUMP_PACKETLOGGER);
break;
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);
hci_dump_posix_fs_open(string_buffer, HCI_DUMP_BLUEZ);
break;
default:
break;
}
// hci_dump_open(string_buffer, BTSTACK_LOG_TYPE);
hci_dump_init(hci_dump_impl);
printf("Logging to %s\n", string_buffer);
}
if (!enabled && loggingEnabled){
// hci_dump_close();
hci_dump_posix_fs_close();
hci_dump_init(NULL);
}
loggingEnabled = enabled;
}

View File

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

View File

@ -1,7 +1,7 @@
# Makefile for libusb based examples
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 += btstack_audio_portaudio.c btstack_chipset_intel_firmware.c rijndael.c

View File

@ -61,6 +61,7 @@
#include "hal_led.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h"
#include "btstack_audio.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, ".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);
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER);
// setup USB Transport
transport = hci_transport_usb_instance();

View File

@ -1,7 +1,7 @@
# Makefile for libusb based examples
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 += btstack_audio_portaudio.c btstack_chipset_zephyr.c rijndael.c

View File

@ -62,6 +62,7 @@
#include "hal_led.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h"
#include "btstack_audio.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);
}
// 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];
strcpy(pklg_path, "/tmp/hci_dump");
if (usb_path_len){
@ -220,8 +220,10 @@ int main(int argc, const char * argv[]){
strcat(pklg_path, usb_path_string);
}
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);
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER);
// init HCI
hci_init(hci_transport_usb_instance(), NULL);

View File

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

View File

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

View File

@ -61,6 +61,7 @@
#include "btstack_uart.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h"
#include "btstack_tlv_posix.h"
@ -167,10 +168,12 @@ int main(int argc, const char * argv[]){
/// GET STARTED with BTstack ///
btstack_memory_init();
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";
// 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);
// pick serial port and configure uart block driver

View File

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

View File

@ -60,6 +60,7 @@
#include "ble/le_device_db_tlv.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h"
#include "btstack_tlv_posix.h"
@ -162,10 +163,12 @@ int main(int argc, const char * argv[]){
/// GET STARTED with BTstack ///
btstack_memory_init();
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";
// 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);
// pick serial port and configure uart block driver

View File

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

View File

@ -60,6 +60,7 @@
#include "ble/le_device_db_tlv.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h"
#include "btstack_tlv_posix.h"
@ -162,10 +163,12 @@ int main(int argc, const char * argv[]){
/// GET STARTED with BTstack ///
btstack_memory_init();
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";
// 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);
// pick serial port and configure uart block driver

View File

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

View File

@ -61,6 +61,7 @@
#include "ble/le_device_db_tlv.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h"
#include "btstack_chipset_zephyr.h"
#include "btstack_tlv_posix.h"
@ -138,10 +139,12 @@ int main(int argc, const char * argv[]){
/// GET STARTED with BTstack ///
btstack_memory_init();
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";
// 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);
// pick serial port

View File

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

View File

@ -63,6 +63,7 @@
#include "bluetooth_company_id.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h"
#include "btstack_tlv_posix.h"
@ -240,9 +241,11 @@ int main(int argc, const char * argv[]){
btstack_memory_init();
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";
// 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);
// pick serial port

View File

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

View File

@ -61,6 +61,7 @@
#include "bluetooth_company_id.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h"
#include "btstack_tlv_posix.h"
#include "btstack_uart.h"
@ -201,10 +202,12 @@ int main(int argc, const char * argv[]){
/// GET STARTED with BTstack ///
btstack_memory_init();
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";
// 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);
// pick serial port

View File

@ -59,6 +59,7 @@ file(GLOB SOURCES_RIJNDAEL "${BTSTACK_ROOT}/3rd-party/rijndael/rijndael.c")
set(SOURCES_POSIX
${BTSTACK_ROOT}/platform/posix/btstack_audio_portaudio.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
)

View File

@ -65,6 +65,7 @@
#include "hal_led.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h"
#include "btstack_audio.h"
#include "btstack_tlv_posix.h"
@ -238,15 +239,17 @@ int main(int argc, char * argv[]){
btstack_memory_init();
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];
#ifdef Q_OS_WIN
strcpy(pklg_path, "hci_dump.pklg");
#else
strcpy(pklg_path, "/tmp/hci_dump.pklg");
#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);
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER);
// init HCI
#ifdef Q_OS_WIN

View File

@ -56,6 +56,7 @@ file(GLOB SOURCES_RIJNDAEL "${BTSTACK_ROOT}/3rd-party/rijndael/rijndael.c")
set(SOURCES_POSIX
${BTSTACK_ROOT}/platform/posix/btstack_audio_portaudio.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
)

View File

@ -64,6 +64,7 @@
#include "hal_led.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h"
#include "btstack_audio.h"
#include "btstack_tlv_posix.h"
@ -209,8 +210,7 @@ int main(int argc, char * argv[]){
}
#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];
#ifdef __WIN32
strcpy(pklg_path, "hci_dump");
@ -222,8 +222,10 @@ int main(int argc, char * argv[]){
}
#endif
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);
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER);
// init HCI
#if 1

View File

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

View File

@ -67,6 +67,7 @@
#include "bluetooth_company_id.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h"
#include "btstack_tlv_posix.h"
#include "btstack_uart.h"
@ -300,9 +301,11 @@ int main(int argc, const char * argv[]){
/// GET STARTED with BTstack ///
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";
// 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);
// setup run loop

View File

@ -1,7 +1,7 @@
# Makefile for windows-h4-da14585 examples
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 += \
btstack_run_loop_windows.c \

View File

@ -59,6 +59,7 @@
#include "ble/le_device_db_tlv.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h"
#include "btstack_tlv_posix.h"
#include "hal_led.h"
@ -162,9 +163,11 @@ int main(int argc, const char * argv[]){
btstack_memory_init();
btstack_run_loop_init(btstack_run_loop_windows_get_instance());
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT
const char * pklg_path = "hci_dump.pklg";
// hci_dump_open(pklg_path, 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 and configure uart block driver

View File

@ -1,7 +1,7 @@
# Makefile for windows-h4 examples
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 += \
btstack_chipset_zephyr.c \

View File

@ -59,6 +59,7 @@
#include "bluetooth_company_id.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h"
#include "btstack_chipset_zephyr.h"
#include "hal_led.h"
@ -141,9 +142,11 @@ int main(int argc, const char * argv[]){
btstack_memory_init();
btstack_run_loop_init(btstack_run_loop_windows_get_instance());
// use logger: format HCI_DUMP_PACKETLOGGER, HCI_DUMP_BLUEZ or HCI_DUMP_STDOUT
const char * pklg_path = "hci_dump.pklg";
// hci_dump_open(pklg_path, 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

View File

@ -1,7 +1,7 @@
# Makefile for windows-h4 examples
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 += \
btstack_run_loop_windows.c \

View File

@ -53,6 +53,7 @@
#include "btstack_run_loop_windows.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "hal_led.h"
#include "btstack_tlv_posix.h"
#include "ble/le_device_db_tlv.h"
@ -226,7 +227,12 @@ int main(int argc, const char * argv[]){
btstack_memory_init();
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
config.device_name = "\\\\.\\COM7";

View File

@ -1,7 +1,7 @@
# Makefile for windows WinUSB based examples
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 += btstack_chipset_intel_firmware.c rijndael.c

View File

@ -62,6 +62,7 @@
#include "hal_led.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h"
#include "btstack_chipset_intel_firmware.h"
@ -155,18 +156,13 @@ int main(int argc, const char * argv[]){
/// GET STARTED with BTstack ///
btstack_memory_init();
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
char pklg_path[100];
strcpy(pklg_path, "hci_dump");
strcat(pklg_path, ".pklg");
// 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);
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER);
// handle CTRL-c
signal(SIGINT, sigint_handler);

View File

@ -1,7 +1,7 @@
# Makefile for windows WinUSB based examples
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 += rijndael.c

View File

@ -62,6 +62,7 @@
#include "hal_led.h"
#include "hci.h"
#include "hci_dump.h"
#include "hci_dump_posix_fs.h"
#include "btstack_stdin.h"
int btstack_main(int argc, const char * argv[]);
@ -128,11 +129,12 @@ int main(int argc, const char * argv[]){
btstack_memory_init();
btstack_run_loop_init(btstack_run_loop_windows_get_instance());
char pklg_path[100];
strcpy(pklg_path, "hci_dump");
strcat(pklg_path, ".pklg");
// 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);
// hci_dump_open(pklg_path, HCI_DUMP_PACKETLOGGER);
// init HCI
hci_init(hci_transport_usb_instance(), NULL);