This patch gives an alternative frame dump output for irdadump. It does
not have a maximum length, and is specified by setting the snaplen to
less than or equal to 0. It displays messages in the following format:

irdadump -s -1 -x -i irda1
Using interface: irda1

16:05:14.852269 xid:cmd da90fde6 > ffffffff S=6 s=5 (14)
        ff 3f 01 e6 fd 90 da ff
        ff ff ff 01 05 00

16:05:14.952290 xid:cmd da90fde6 > ffffffff S=6 s=* xerxes hint=0400 [ Computer ] (22)
        ff 3f 01 e6 fd 90 da ff
        ff ff ff 01 ff 00 04 00
        78 65 72 78 65 73

16:05:14.962261 xid:rsp da90fde6 < 22b4632f S=6 s=5 MIB IV Pump hint=8010 [ ] (29)
        fe bf 01 2f 63 b4 22 e6
        fd 90 da 01 05 00 80 10
        00 4d 49 42 20 49 56 20
        50 75 6d 70 00

--
I have found this to be useful in debugging, as it makes it easier to see
the bytes and doesn't truncate any messages.

Timothy Kilbourn


--- irda-utils-0.9.14/irdadump/src/irdadump.c   Sun Jan 14 17:12:56 2001
+++ irda-utils-0.9.14-fix/irdadump/src/irdadump.c       Wed Apr  3 16:41:06 2002
@@ -829,20 +829,37 @@
                int i, maxlen;
                char c;

-               g_string_append(str, "\n\t");
-               maxlen = (len < snaplen) ? len : snaplen;
-
-               for (i=0;i<maxlen;i++)
+                g_string_append(str, "\n\t");
+
+                if( snaplen > 0 )
+                {
+                    maxlen = (len < snaplen) ? len : snaplen;
+
+
+                    for (i=0;i<maxlen;i++)
                        g_string_sprintfa(str, "%02x", buf->head[i]);
-               g_string_append(str, "\n\t");
-
-               for (i=0;i<maxlen;i++) {
+                    g_string_append(str, "\n\t");
+
+                    for (i=0;i<maxlen;i++) {
                        c = buf->head[i];
                        if (c < 32 || c > 126)
-                               c='.';
+                            c='.';
                        g_string_sprintfa(str, " %c", c);
-               }
-       }
+                    }
+                }
+                else
+                {
+                    int j, rows;
+                    rows = len / 8 + 1;
+
+                    for(i=0; i<rows; i++)
+                    {
+                        for(j=0; j<8 && i*8+j < len; j++)
+                            g_string_sprintfa(str, "%02x ", buf->head[i*8+j]);
+                        g_string_append(str, "\n\t");
+                    }
+                }
+        }
        return 0;
 }



_______________________________________________
Linux-IrDA mailing list  -  [EMAIL PROTECTED]
http://www.pasta.cs.UiT.No/mailman/listinfo/linux-irda

Reply via email to