aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-25 11:17:13 -0300
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-25 11:17:13 -0300
commit3ab2d8c43c37205de92f84e865a46eadb9f0cf44 (patch)
treea929b29912167d8518d79e563f51beb1fd59ee03
parentdcfc3df5d17801e159abf3919c153ce3744830b6 (diff)
parse_usb.pl: fix handling of ./parse_tcpdump_log.pl logs
The regex were not parsing right those logs. Fix it, and add the timestamps to the dumps. Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rwxr-xr-xcontrib/usb_parse/parse_usb.pl23
1 files changed, 13 insertions, 10 deletions
diff --git a/contrib/usb_parse/parse_usb.pl b/contrib/usb_parse/parse_usb.pl
index 5af64084..3d889438 100755
--- a/contrib/usb_parse/parse_usb.pl
+++ b/contrib/usb_parse/parse_usb.pl
@@ -61,16 +61,19 @@ sub type_req($)
}
while (<>) {
- tr/A-F/a-f/;
- if (m/([0-9a-f].) ([0-9a-f].) ([0-9a-f].) ([0-9a-f].) ([0-9a-f].) ([0-9a-f].) ([0-9a-f].) ([0-9a-f].)[\<\>\s]+(.*)/) {
- my $reqtype = hex($1);
- my $req = hex($2);
- my $wvalue = hex("$4$3");
- my $windex = hex("$6$5");
- my $wlen = hex("$8$7");
- my $payload = $9;
+ if (m/(.*)([0-9a-f].) ([0-9a-f].) ([0-9a-f].) ([0-9a-f].) ([0-9a-f].) ([0-9a-f].) ([0-9a-f].) ([0-9a-f].)[\<\>\s]+(.*)/) {
+ my $timestamp = $1;
+ my $reqtype = hex($2);
+ my $req = hex($3);
+ my $wvalue = hex("$5$4");
+ my $windex = hex("$7$6");
+ my $wlen = hex("$9$8");
+ my $payload = $10;
- printf("%s, Req %3d, wValue: 0x%04x, wIndex 0x%04x, wlen %d: %s\n",
- type_req($reqtype), $req, $wvalue, $windex, $wlen, $payload);
+ $timestamp =~ s/^\s+//;
+ $timestamp =~ s/\s+$//;
+
+ printf("%s %s(0x%02x), Req 0x%02x, wValue: 0x%04x, wIndex 0x%04x, wlen %d: %s\n",
+ $timestamp, type_req($reqtype), $reqtype, $req, $wvalue, $windex, $wlen, $payload);
}
}

Privacy Policy