diff --git a/src/hci_dump.c b/src/hci_dump.c index 40d48fbb2..c4144f6d8 100644 --- a/src/hci_dump.c +++ b/src/hci_dump.c @@ -55,16 +55,6 @@ #include #ifndef EMBEDDED -#ifdef _WIN32 -// -#define S_IRWXG 0 -#define S_IRWXO 0 -#define S_IRGRP 0 -#define S_IROTH 0 -#include "Winsock2.h" // hton.. -#else -#include // hton.. -#endif #include // open #include // write #include @@ -118,7 +108,11 @@ void hci_dump_open(const char *filename, hci_dump_format_t format){ if (dump_format == HCI_DUMP_STDOUT) { dump_file = fileno(stdout); } else { +#ifdef _WIN32 + dump_file = open(filename, O_WRONLY | O_CREAT | O_TRUNC); +#else dump_file = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); +#endif } #endif } @@ -203,9 +197,9 @@ void hci_dump_packet(uint8_t packet_type, uint8_t in, uint8_t *packet, uint16_t break; case HCI_DUMP_PACKETLOGGER: - header_packetlogger.len = htonl( sizeof(pktlog_hdr) - 4 + len); - header_packetlogger.ts_sec = htonl(curr_time.tv_sec); - header_packetlogger.ts_usec = htonl(curr_time.tv_usec); + net_store_32( (uint8_t *) &header_packetlogger, 0, sizeof(pktlog_hdr) - 4 + len); + net_store_32( (uint8_t *) &header_packetlogger, 4, curr_time.tv_sec); + net_store_32( (uint8_t *) &header_packetlogger, 8, curr_time.tv_usec); switch (packet_type){ case HCI_COMMAND_DATA_PACKET: header_packetlogger.type = 0x00;