]> mj.ucw.cz Git - home-hw.git/commitdiff
BSB Daemon: Dump has timestamps
authorMartin Mares <mj@ucw.cz>
Fri, 28 Feb 2020 14:27:47 +0000 (15:27 +0100)
committerMartin Mares <mj@ucw.cz>
Fri, 28 Feb 2020 14:27:47 +0000 (15:27 +0100)
bsb/daemon/Makefile
bsb/daemon/burrow-bsb.c

index e66ceddd5d14d6939efd0847853dbbdb9daa5b89..1e97498cae88e04cb74d2ee99c62cf317c2c11eb 100644 (file)
@@ -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
 
index 208056a191b159e760fb1651bf135e74d7f903b1..e8bd4ca0b5de47a9636b6e440f62e46d71a4e225 100644 (file)
@@ -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<len; i++)
                printf(" %02x", pkt[i]);
@@ -192,7 +198,7 @@ int main(void)
                                // usb_error("Receive failed: error %d", received);
                                // continue;
                        } else {
-                               printf("Send OK: %d bytes\n", received);
+                               // printf("Send OK: %d bytes\n", received);
                        }
                        last_query = now;
                }