diff --git a/monitor/btsnoop.h b/monitor/btsnoop.h
index cdefb8c..5067f45 100644
--- a/monitor/btsnoop.h
+++ b/monitor/btsnoop.h
#define BTSNOOP_OPCODE_SCO_TX_PKT 6
#define BTSNOOP_OPCODE_SCO_RX_PKT 7
+struct btsnoop_opcode_new_index {
+ uint8_t type;
+ uint8_t bus;
+ uint8_t bdaddr[6];
+ char name[8];
+} __attribute__((packed));
+
void btsnoop_create(const char *path, uint32_t type);
void btsnoop_write(struct timeval *tv, uint32_t flags,
const void *data, uint16_t size);
diff --git a/monitor/packet.c b/monitor/packet.c
index 8b298d3..03d0d5d 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
control_message(opcode, data, size);
}
-struct monitor_new_index {
- uint8_t type;
- uint8_t bus;
- bdaddr_t bdaddr;
- char name[8];
-} __attribute__((packed));
-
-#define MONITOR_NEW_INDEX_SIZE 16
-
-#define MONITOR_DEL_INDEX_SIZE 0
-
#define MAX_INDEX 16
struct index_data {
void packet_monitor(struct timeval *tv, uint16_t index, uint16_t opcode,
const void *data, uint16_t size)
{
- const struct monitor_new_index *ni;
+ const struct btsnoop_opcode_new_index *ni;
char str[18], extra_str[24];
+ bdaddr_t bdaddr;
if (index_filter && index_number != index)
return;
switch (opcode) {
case BTSNOOP_OPCODE_NEW_INDEX:
ni = data;
+ memcpy(&bdaddr, ni->bdaddr, 6);
if (index < MAX_INDEX) {
index_list[index].type = ni->type;
- bacpy(&index_list[index].bdaddr, &ni->bdaddr);
+ memcpy(&index_list[index].bdaddr, &bdaddr, 6);
}
- ba2str(&ni->bdaddr, str);
+ ba2str(&bdaddr, str);
packet_new_index(tv, index, str, ni->type, ni->bus, ni->name);
break;
case BTSNOOP_OPCODE_DEL_INDEX: