hci_dump: log sco packets in STDOUT mode, use binary mode and correct file permissions on windows

This commit is contained in:
Matthias Ringwald 2017-01-10 14:03:12 +01:00
parent 219d8683c5
commit 01f6d60c42

View File

@ -107,12 +107,15 @@ void hci_dump_open(const char *filename, hci_dump_format_t format){
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
int oflags = O_WRONLY | O_CREAT | O_TRUNC;
#ifdef _WIN32
oflags |= O_BINARY;
#endif
dump_file = open(filename, oflags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH );
if (dump_file < 0){
printf("hci_dump_open: failed to open file %s\n", filename);
}
}
#else
UNUSED(filename);
@ -143,6 +146,13 @@ static void printf_packet(uint8_t packet_type, uint8_t in, uint8_t * packet, uin
printf("ACL => ");
}
break;
case HCI_SCO_DATA_PACKET:
if (in) {
printf("SCO <= ");
} else {
printf("SCO => ");
}
break;
case LOG_MESSAGE_PACKET:
printf("LOG -- %s\n", (char*) packet);
return;