diff --git a/monitor/btsnoop.c b/monitor/btsnoop.c
index c07eb2d..0b3e412 100644
--- a/monitor/btsnoop.c
+++ b/monitor/btsnoop.c
struct btsnoop_pkt pkt;
uint32_t toread, flags;
uint64_t ts;
+ uint8_t pkt_type;
ssize_t len;
if (btsnoop_fd < 0)
switch (btsnoop_type) {
case 1001:
*index = 0;
- *opcode = packet_get_opcode(flags);
+ *opcode = packet_get_opcode(0xff, flags);
+ break;
+
+ case 1002:
+ len = read(btsnoop_fd, &pkt_type, 1);
+ if (len < 0) {
+ perror("Failed to read packet type");
+ close(btsnoop_fd);
+ btsnoop_fd = -1;
+ return -1;
+ }
+ toread--;
+
+ *index = 0;
+ *opcode = packet_get_opcode(pkt_type, flags);
break;
case 2001:
diff --git a/monitor/packet.c b/monitor/packet.c
index eb1387e..0c4d360 100644
--- a/monitor/packet.c
+++ b/monitor/packet.c
return 0xff;
}
-uint16_t packet_get_opcode(uint32_t flags)
+uint16_t packet_get_opcode(uint8_t type, uint32_t flags)
{
- if (flags & 0x02) {
- if (flags & 0x01)
- return MONITOR_EVENT_PKT;
- else
- return MONITOR_COMMAND_PKT;
- } else {
+ switch (type) {
+ case HCI_COMMAND_PKT:
+ return MONITOR_COMMAND_PKT;
+ case HCI_ACLDATA_PKT:
if (flags & 0x01)
return MONITOR_ACL_RX_PKT;
else
return MONITOR_ACL_TX_PKT;
+ case HCI_SCODATA_PKT:
+ if (flags & 0x01)
+ return MONITOR_SCO_RX_PKT;
+ else
+ return MONITOR_SCO_TX_PKT;
+ case HCI_EVENT_PKT:
+ return MONITOR_EVENT_PKT;
+ case 0xff:
+ if (flags & 0x02) {
+ if (flags & 0x01)
+ return MONITOR_EVENT_PKT;
+ else
+ return MONITOR_COMMAND_PKT;
+ } else {
+ if (flags & 0x01)
+ return MONITOR_ACL_RX_PKT;
+ else
+ return MONITOR_ACL_TX_PKT;
+ }
+ break;
}
return 0xff;
diff --git a/monitor/packet.h b/monitor/packet.h
index dd2f5e3..ea21bd7 100644
--- a/monitor/packet.h
+++ b/monitor/packet.h
const void *data, uint16_t size);
uint32_t packet_get_flags(uint16_t opcode);
-uint16_t packet_get_opcode(uint32_t flags);
+uint16_t packet_get_opcode(uint8_t type, uint32_t flags);
void packet_new_index(struct timeval *tv, uint16_t index, const char *label,
uint8_t type, uint8_t bus, const char *name);