From 1df3b67945d1aa82fa7636c2ebde69a3e6029268 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald@gmail.com" Date: Sun, 16 Nov 2014 23:34:46 +0000 Subject: [PATCH] fix log_* for embedded hci_dump --- src/hci_dump.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/hci_dump.c b/src/hci_dump.c index c4144f6d8..e3cf45651 100644 --- a/src/hci_dump.c +++ b/src/hci_dump.c @@ -52,6 +52,7 @@ #include "hci.h" #include "hci_transport.h" #include +#include #include #ifndef EMBEDDED @@ -152,6 +153,10 @@ void hci_dump_packet(uint8_t packet_type, uint8_t in, uint8_t *packet, uint16_t if (dump_file < 0) return; // not activated yet #ifdef EMBEDDED +// #ifdef HAVE_TICK +// uint32_t time_ms = embedded_get_time_ms(); +// printf("[%06u] ", time_ms); +// #endif printf_packet(packet_type, in, packet, len); #else // don't grow bigger than max_nr_packets @@ -231,13 +236,20 @@ void hci_dump_packet(uint8_t packet_type, uint8_t in, uint8_t *packet, uint16_t } void hci_dump_log(const char * format, ...){ -#ifndef EMBEDDED + + if (dump_file < 0) return; // not activated yet + va_list argptr; va_start(argptr, format); +#ifdef EMBEDDED + printf("LOG -- "); + vprintf(format, argptr); + putchar('\n'); +#else int len = vsnprintf(log_message_buffer, sizeof(log_message_buffer), format, argptr); hci_dump_packet(LOG_MESSAGE_PACKET, 0, (uint8_t*) log_message_buffer, len); - va_end(argptr); #endif + va_end(argptr); } void hci_dump_close(){