X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb/blobdiff_plain/d57fdaf62fa1ce7e8573404206903ad281ff889c..e2776af8fe91dec685980fd5ef75736be9d6402d:/hmsniff.c diff --git a/hmsniff.c b/hmsniff.c index 6260cb6..9ce1fce 100644 --- a/hmsniff.c +++ b/hmsniff.c @@ -29,10 +29,7 @@ #include #include #include -#include -#include -#include -#include +#include #include #include "hexdump.h" @@ -95,8 +92,17 @@ char *hm_message_types(uint8_t type) static void dissect_hm(uint8_t *buf, int len) { + struct timeval tv; + struct tm *tmp; + char ts[32]; int i; + gettimeofday(&tv, NULL); + tmp = localtime(&tv.tv_sec); + memset(ts, 0, sizeof(ts)); + strftime(ts, sizeof(ts)-1, "%Y-%m-%d %H:%M:%S", tmp); + printf("%s.%06ld: ", ts, tv.tv_usec); + for (i = 0; i < len; i++) { printf("%02X", buf[i]); } @@ -110,7 +116,7 @@ static void dissect_hm(uint8_t *buf, int len) printf("\t\tFlags: "); if (buf[2] & (1 << 0)) printf("WAKEUP "); if (buf[2] & (1 << 1)) printf("WAKEMEUP "); - if (buf[2] & (1 << 2)) printf("BCAST "); + if (buf[2] & (1 << 2)) printf("CFG "); if (buf[2] & (1 << 3)) printf("? "); if (buf[2] & (1 << 4)) printf("BURST "); if (buf[2] & (1 << 5)) printf("BIDI ");