hci_dump: use H4 format in btsnoop log format

This commit is contained in:
Matthias Ringwald 2022-03-23 14:31:25 +01:00
parent 92da54c428
commit 26d7634cac

View File

@ -103,7 +103,7 @@ static void hci_dump_posix_fs_log_packet(uint8_t packet_type, uint8_t in, uint8_
static union {
uint8_t header_bluez[HCI_DUMP_HEADER_SIZE_BLUEZ];
uint8_t header_packetlogger[HCI_DUMP_HEADER_SIZE_PACKETLOGGER];
uint8_t header_btsnoop[HCI_DUMP_HEADER_SIZE_BTSNOOP];
uint8_t header_btsnoop[HCI_DUMP_HEADER_SIZE_BTSNOOP+1];
} header;
uint32_t tv_sec = 0;
@ -142,8 +142,10 @@ static void hci_dump_posix_fs_log_packet(uint8_t packet_type, uint8_t in, uint8_
// log messages not supported
if (packet_type == LOG_MESSAGE_PACKET) return;
ts_usec = ((uint64_t) curr_time.tv_sec) * 1000000 + curr_time.tv_usec;
hci_dump_setup_header_btsnoop(header.header_btsnoop, ts_usec >> 32, ts_usec & 0xFFFFFFFF, 0, packet_type, in, len);
header_len = HCI_DUMP_HEADER_SIZE_BTSNOOP;
// append packet type to pcap header
hci_dump_setup_header_btsnoop(header.header_btsnoop, ts_usec >> 32, ts_usec & 0xFFFFFFFF, 0, packet_type, in, len+1);
header.header_btsnoop[HCI_DUMP_HEADER_SIZE_BTSNOOP] = packet_type;
header_len = HCI_DUMP_HEADER_SIZE_BTSNOOP + 1;
break;
default:
btstack_unreachable();
@ -185,8 +187,8 @@ int hci_dump_posix_fs_open(const char *filename, hci_dump_format_t format){
0x62, 0x74, 0x73, 0x6E, 0x6F, 0x6F, 0x70, 0x00,
// Version: 1
0x00, 0x00, 0x00, 0x01,
// Datalink Type: 1001 - Un-encapsulated HCI
0x00, 0x00, 0x03, 0xE9,
// Datalink Type: 1002 - H4
0x00, 0x00, 0x03, 0xEA,
};
ssize_t bytes_written = write(dump_file, &file_header, sizeof(file_header));
UNUSED(bytes_written);