Loading system/conf/bt_stack.conf +3 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,9 @@ BtSnoopLogOutput=false # BtSnoop log output file BtSnoopFileName=/sdcard/btsnoop_hci.log # Preserve existing BtSnoop log before overwriting BtSnoopSaveLog=false # Enable trace level reconfiguration function # Must be present before any TRC_ trace level settings TraceConf=true Loading system/hci/include/bt_hci_lib.h +2 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #define BT_HCI_LIB_H #include <stdint.h> #include <stdbool.h> #include <sys/cdefs.h> #include <sys/types.h> Loading Loading @@ -187,7 +188,7 @@ typedef struct { int (*transmit_buf)(TRANSAC transac, char *p_buf, int len); /** Controls HCI logging on/off */ int (*logging)(bt_hc_logging_state_t state, char *p_path); int (*logging)(bt_hc_logging_state_t state, char *p_path, bool save_existing); /** Closes the interface */ void (*cleanup)( void ); Loading system/hci/include/btsnoop.h +1 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ #include "bt_hci_bdroid.h" void btsnoop_open(const char *p_path); void btsnoop_open(const char *p_path, const bool save_existing); void btsnoop_close(void); void btsnoop_capture(const HC_BT_HDR *p_buf, bool is_rcvd); system/hci/src/bt_hci_bdroid.c +2 −2 Original line number Diff line number Diff line Loading @@ -427,13 +427,13 @@ static int transmit_buf(TRANSAC transac, UNUSED_ATTR char *p_buf, UNUSED_ATTR in } /** Controls HCI logging on/off */ static int logging(bt_hc_logging_state_t state, char *p_path) { static int logging(bt_hc_logging_state_t state, char *p_path, bool save_existing) { BTHCDBG("logging %d", state); if (state != BT_HC_LOGGING_ON) btsnoop_close(); else if (p_path != NULL) btsnoop_open(p_path); btsnoop_open(p_path, save_existing); return BT_HC_STATUS_SUCCESS; } Loading system/hci/src/btsnoop.c +9 −1 Original line number Diff line number Diff line Loading @@ -120,7 +120,7 @@ static void btsnoop_write_packet(packet_type_t type, const uint8_t *packet, bool utils_unlock(); } void btsnoop_open(const char *p_path) { void btsnoop_open(const char *p_path, const bool save_existing) { assert(p_path != NULL); assert(*p_path != '\0'); Loading @@ -131,6 +131,14 @@ void btsnoop_open(const char *p_path) { return; } if (save_existing) { char fname_backup[266] = {0}; strncat(fname_backup, p_path, 255); strcat(fname_backup, ".last"); rename(p_path, fname_backup); } hci_btsnoop_fd = open(p_path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH); Loading Loading
system/conf/bt_stack.conf +3 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,9 @@ BtSnoopLogOutput=false # BtSnoop log output file BtSnoopFileName=/sdcard/btsnoop_hci.log # Preserve existing BtSnoop log before overwriting BtSnoopSaveLog=false # Enable trace level reconfiguration function # Must be present before any TRC_ trace level settings TraceConf=true Loading
system/hci/include/bt_hci_lib.h +2 −1 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #define BT_HCI_LIB_H #include <stdint.h> #include <stdbool.h> #include <sys/cdefs.h> #include <sys/types.h> Loading Loading @@ -187,7 +188,7 @@ typedef struct { int (*transmit_buf)(TRANSAC transac, char *p_buf, int len); /** Controls HCI logging on/off */ int (*logging)(bt_hc_logging_state_t state, char *p_path); int (*logging)(bt_hc_logging_state_t state, char *p_path, bool save_existing); /** Closes the interface */ void (*cleanup)( void ); Loading
system/hci/include/btsnoop.h +1 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ #include "bt_hci_bdroid.h" void btsnoop_open(const char *p_path); void btsnoop_open(const char *p_path, const bool save_existing); void btsnoop_close(void); void btsnoop_capture(const HC_BT_HDR *p_buf, bool is_rcvd);
system/hci/src/bt_hci_bdroid.c +2 −2 Original line number Diff line number Diff line Loading @@ -427,13 +427,13 @@ static int transmit_buf(TRANSAC transac, UNUSED_ATTR char *p_buf, UNUSED_ATTR in } /** Controls HCI logging on/off */ static int logging(bt_hc_logging_state_t state, char *p_path) { static int logging(bt_hc_logging_state_t state, char *p_path, bool save_existing) { BTHCDBG("logging %d", state); if (state != BT_HC_LOGGING_ON) btsnoop_close(); else if (p_path != NULL) btsnoop_open(p_path); btsnoop_open(p_path, save_existing); return BT_HC_STATUS_SUCCESS; } Loading
system/hci/src/btsnoop.c +9 −1 Original line number Diff line number Diff line Loading @@ -120,7 +120,7 @@ static void btsnoop_write_packet(packet_type_t type, const uint8_t *packet, bool utils_unlock(); } void btsnoop_open(const char *p_path) { void btsnoop_open(const char *p_path, const bool save_existing) { assert(p_path != NULL); assert(*p_path != '\0'); Loading @@ -131,6 +131,14 @@ void btsnoop_open(const char *p_path) { return; } if (save_existing) { char fname_backup[266] = {0}; strncat(fname_backup, p_path, 255); strcat(fname_backup, ".last"); rename(p_path, fname_backup); } hci_btsnoop_fd = open(p_path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH); Loading