]> rtime.felk.cvut.cz Git - socketcan-devel.git/commitdiff
Added the blanking of 'old' data when the can_dlc decreases between two
authorhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Mon, 16 Jul 2007 09:52:43 +0000 (09:52 +0000)
committerhartkopp <hartkopp@030b6a49-0b11-0410-94ab-b0dab22257f2>
Mon, 16 Jul 2007 09:52:43 +0000 (09:52 +0000)
receiptions of the same can_id.
Thanks to Andre Naujoks for the bug report.

git-svn-id: svn://svn.berlios.de//socketcan/trunk@431 030b6a49-0b11-0410-94ab-b0dab22257f2

can-utils/cansniffer.c

index ed3f869f30ae7ff1b9aeb88e08c03bd6694f9794..c184e37c46618639f37cc6ddfb5b5ee5ae93abc8 100644 (file)
@@ -580,6 +580,7 @@ void print_snifline(int id){
 
     long diffsec  = sniftab[id].currstamp.tv_sec  - sniftab[id].laststamp.tv_sec;
     long diffusec = sniftab[id].currstamp.tv_usec - sniftab[id].laststamp.tv_usec;
+    int dlc_diff  = sniftab[id].last.can_dlc - sniftab[id].current.can_dlc;
     int i,j;
 
     if (diffusec < 0)
@@ -612,6 +613,16 @@ void print_snifline(int id){
            if (binary_gap)
                putchar(' ');
        }
+
+       /*
+        * when the can_dlc decreased (dlc_diff > 0),
+        * we need to blank the former data printout
+        */
+       for (i=0; i<dlc_diff; i++) {
+           printf("        ");
+           if (binary_gap)
+               putchar(' ');
+       }
     }
     else {
 
@@ -633,6 +644,13 @@ void print_snifline(int id){
                    putchar(sniftab[id].current.data[i]);
            else
                putchar('.');
+
+       /*
+        * when the can_dlc decreased (dlc_diff > 0),
+        * we need to blank the former data printout
+        */
+       for (i=0; i<dlc_diff; i++)
+           putchar(' ');
     }
 
     putchar('\n');