X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=apps%2FBaseStation15.4%2Fseriallisten15-4.c;h=e84272a380241fecb57cf295cac9b56821f9919a;hb=13e400e82fdf39ec7807c7b290136408044d6273;hp=b9c334d2c7cbfd908b4826647e534db919cab8e4;hpb=4b103ee828fe921effeb58a885986d19b8754e1f;p=tinyos-2.x.git diff --git a/apps/BaseStation15.4/seriallisten15-4.c b/apps/BaseStation15.4/seriallisten15-4.c index b9c334d2..e84272a3 100644 --- a/apps/BaseStation15.4/seriallisten15-4.c +++ b/apps/BaseStation15.4/seriallisten15-4.c @@ -1,5 +1,6 @@ #include #include +#include #include "serialsource.h" @@ -28,19 +29,31 @@ enum { int main(int argc, char **argv) { serial_source src; + int iframes = 0; + if (argc != 4) { + fprintf(stderr, "Usage: %s - dump packets from a serial port\n", argv[0]); + exit(2); + } - if (argc != 3) - { - fprintf(stderr, "Usage: %s - dump packets from a serial port\n", argv[0]); - exit(2); - } - src = open_serial_source(argv[1], platform_baud_rate(argv[2]), 0, stderr_msg); - if (!src) - { - fprintf(stderr, "Couldn't open serial port at %s:%s\n", - argv[1], argv[2]); - exit(1); - } + if (strncmp(argv[1], "tframe", strlen("tframe")) == 0) { + iframes = 0; + } + else if (strncmp(argv[1], "iframe", strlen("iframe")) == 0) { + iframes = 1; + } + else { + fprintf(stderr, "Usage: %s - dump packets from a serial port\n", argv[0]); + exit(3); + } + + src = open_serial_source(argv[2], platform_baud_rate(argv[3]), 0, stderr_msg); + + if (!src) { + fprintf(stderr, "Couldn't open serial port at %s:%s\n", + argv[2], argv[3]); + exit(1); + } + for (;;) { int len, i, plen; @@ -164,6 +177,10 @@ int main(int argc, char **argv) printf(" Source address: parse serror\n"); } } + + if (iframes) { + printf(" I-Frame: %s\n", (packet[i++] == 0x3f)? "yes":"no"); + } printf(" AM type: 0x%02hhx\n", packet[i++]);