From 7d0d377066bc5377ced6bbac9389c162a3e36973 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 28 Feb 2020 15:27:47 +0100 Subject: [PATCH] BSB Daemon: Dump has timestamps --- bsb/daemon/Makefile | 6 ++++-- bsb/daemon/burrow-bsb.c | 12 +++++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/bsb/daemon/Makefile b/bsb/daemon/Makefile index e66cedd..1e97498 100644 --- a/bsb/daemon/Makefile +++ b/bsb/daemon/Makefile @@ -1,9 +1,11 @@ PC := PKG_CONFIG_PATH=/home/mj/tmp/bsb/root/lib/pkgconfig pkg-config USB_CFLAGS := $(shell $(PC) --cflags libusb-1.0) USB_LDFLAGS := $(shell $(PC) --libs libusb-1.0) +UCW_CFLAGS := $(shell $(PC) --cflags libucw) +UCW_LDFLAGS := $(shell $(PC) --libs libucw) -CFLAGS=$(USB_CFLAGS) $(CURL_CFLAGS) -std=gnu1x -O2 -Wall -Wextra -Wno-parentheses -LDFLAGS=$(USB_LDFLAGS) $(CURL_LDFLAGS) +CFLAGS=$(USB_CFLAGS) $(UCW_CFLAGS) -std=gnu1x -O2 -Wall -Wextra -Wno-parentheses +LDFLAGS=$(USB_LDFLAGS) $(UCW_LDFLAGS) -lmosquitto all: burrow-bsb diff --git a/bsb/daemon/burrow-bsb.c b/bsb/daemon/burrow-bsb.c index 208056a..e8bd4ca 100644 --- a/bsb/daemon/burrow-bsb.c +++ b/bsb/daemon/burrow-bsb.c @@ -105,6 +105,12 @@ static void show_stats(byte *resp, uint len) static void show_packet(byte *pkt, uint len) { + time_t now = time(NULL); + struct tm *tm = localtime(&now); + char timebuf[64]; + strftime(timebuf, sizeof(timebuf), "%Y-%m-%d %H:%M:%S", tm); + printf("%s ", timebuf); + if (!len) { printf("ERROR: Received empty frame!\n"); return; @@ -114,11 +120,11 @@ static void show_packet(byte *pkt, uint len) len--; if (!len) { - printf("Transmit status: %u\n", status); + printf("ERROR: Transmit status: %u\n", status); return; } -#if 1 +#if 0 printf(": [%d]", status); for (uint i=0; i