if (btsnoop_fd < 0)
return;
- btsnoop_type = 2001;
+ btsnoop_type = BTSNOOP_TYPE_EXTENDED_HCI;
memcpy(hdr.id, btsnoop_id, sizeof(btsnoop_id));
hdr.version = htonl(btsnoop_version);
return;
switch (btsnoop_type) {
- case 1001:
+ case BTSNOOP_TYPE_HCI:
if (btsnoop_index == 0xffff)
btsnoop_index = index;
return;
break;
- case 2001:
+ case BTSNOOP_TYPE_EXTENDED_HCI:
flags = (index << 16) | opcode;
break;
btsnoop_type = ntohl(hdr.type);
switch (btsnoop_type) {
- case 1001:
- case 1002:
+ case BTSNOOP_TYPE_HCI:
+ case BTSNOOP_TYPE_UART:
packet_del_filter(PACKET_FILTER_SHOW_INDEX);
break;
- case 2001:
+ case BTSNOOP_TYPE_EXTENDED_HCI:
packet_add_filter(PACKET_FILTER_SHOW_INDEX);
break;
}
tv->tv_usec = ts % 1000000ll;
switch (btsnoop_type) {
- case 1001:
+ case BTSNOOP_TYPE_HCI:
*index = 0;
*opcode = packet_get_opcode(0xff, flags);
break;
- case 1002:
+ case BTSNOOP_TYPE_UART:
len = read(btsnoop_fd, &pkt_type, 1);
if (len < 0) {
perror("Failed to read packet type");
*opcode = packet_get_opcode(pkt_type, flags);
break;
- case 2001:
+ case BTSNOOP_TYPE_EXTENDED_HCI:
*index = flags >> 16;
*opcode = flags & 0xffff;
break;
#include <sys/time.h>
+#define BTSNOOP_TYPE_HCI 1001
+#define BTSNOOP_TYPE_UART 1002
+#define BTSNOOP_TYPE_BCSP 1003
+#define BTSNOOP_TYPE_3WIRE 1004
+
+#define BTSNOOP_TYPE_EXTENDED_HCI 2001
+
void btsnoop_create(const char *path);
void btsnoop_write(struct timeval *tv, uint16_t index, uint16_t opcode,
const void *data, uint16_t size);