/** Controls HCI logging on/off */ 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, save_existing); return BT_HC_STATUS_SUCCESS; }
/** Controls HCI logging on/off */ static int logging(bt_hc_logging_state_t state, char *p_path) { BTHCDBG("logging %d", state); if (state == BT_HC_LOGGING_ON) { if (p_path != NULL) btsnoop_open(p_path); } else { btsnoop_close(); } return BT_HC_STATUS_SUCCESS; }
void control_reader(const char *path) { unsigned char buf[MAX_PACKET_SIZE]; uint16_t index, opcode, pktlen; struct timeval tv; if (btsnoop_open(path) < 0) return; open_pager(); while (1) { if (btsnoop_read(&tv, &index, &opcode, buf, &pktlen) < 0) break; packet_monitor(&tv, index, opcode, buf, pktlen); } close_pager(); btsnoop_close(); }