This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/v4l-utils.git tree:

Subject: parse_tcpdump_log.pl: Improve debug logs
Author:  Mauro Carvalho Chehab <[email protected]>
Date:    Wed Mar 9 01:28:45 2011 -0300

Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 contrib/parse_tcpdump_log.pl |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

---

http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=9ab79cdbc5c8011c6177b3dcc2e18b591fec7d7f

diff --git a/contrib/parse_tcpdump_log.pl b/contrib/parse_tcpdump_log.pl
index 967ce22..183f54f 100755
--- a/contrib/parse_tcpdump_log.pl
+++ b/contrib/parse_tcpdump_log.pl
@@ -8,8 +8,12 @@ use Getopt::Long;
 #      USB with padded Linux header (LINKTYPE_USB_LINUX_MMAPPED)
 # This is the one produced by Beagleboard sniffer GSOC.
 
+# Debug levels:
+#      1 - frame request and frame response
+#      2 - parsed frames
+#      4 - raw data
 my $debug = 0;
-GetOptions('debug' => \$debug);
+GetOptions('debug=i' => \$debug);
 
 # Frame format as parsed by libpcap 1.0.0 and 1.1.1. Not sure if format
 # changed on different versions.
@@ -77,7 +81,7 @@ sub print_frame($$)
 
        print "\n";
 
-       if ($debug) {
+       if ($debug & 1) {
                my ($key, $value);
                print "\tREQ:  $key => $value\n" while (($key, $value) = 
each(%req));
                print "\tRESP: $key => $value\n" while (($key, $value) = 
each(%resp));
@@ -90,8 +94,9 @@ sub print_frame($$)
 sub process_frame($) {
        my %frame = %{ @_[0] };
 
-       if ($debug > 1) {
+       if ($debug & 2) {
                my ($key, $value);
+               print "PARSED data:\n";
                print "\t\tRAW: $key => $value\n" while (($key, $value) = 
each(%frame));
                print "\n";
        }
@@ -147,7 +152,8 @@ sub parse_file($)
                my $strdata = $log->data($index);
                my @data=unpack('C*', $strdata);
 
-               if ($debug > 2) {
+               if ($debug & 4) {
+                       print "RAW DATA: ";
                        for (my $i = 0; $i < scalar(@data); $i++) {
                                printf " %02x", $data[$i];
                        }
@@ -225,11 +231,6 @@ sub parse_file($)
                $frame{"Payload"} = $payload;
                $frame{"PayloadSize"} = $payload_size;
 
-               if ($debug > 1) {
-                       my ($key, $value);
-                       print "\t$key => $value\n" while (($key, $value) = 
each(%frame));
-                       printf "\n";
-               }
                process_frame(\%frame);
        }
 }

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to