diff options
author | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-11-20 13:00:17 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2014-11-20 13:01:46 -0200 |
commit | 61fd7692d41fb5217e93c641af7c1502d3e25183 (patch) | |
tree | 228563b2dfd88541094ec84b9763e567e272313e | |
parent | 757d7910ddf43d9a9187dddae4f51a57fb723e8d (diff) |
parse_tcpdump_log.pl: simplify non-control data
We can remove the first 8 bytes from libpcap packet, as they
seem to be used only with control endpoints (0x80).
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rwxr-xr-x | contrib/parse_tcpdump_log.pl | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/contrib/parse_tcpdump_log.pl b/contrib/parse_tcpdump_log.pl index 89e26d4b..8a6a8131 100755 --- a/contrib/parse_tcpdump_log.pl +++ b/contrib/parse_tcpdump_log.pl @@ -345,15 +345,18 @@ sub print_frame($$) printf " EP=%02x)", $resp{"Endpoint"}; - my $app_data = substr($req{"Payload"}, 0, 8 * 2); - my $type = hex(substr($app_data, 0, 2)); - while ($app_data ne "") { - printf " %s", substr($app_data, 0, 2); - $app_data = substr($app_data, 2); + my ($app_data, $type); + + if ($req{"Endpoint"} == 0x80 || $req{"SetupFlag"} == 0) { + $app_data = substr($req{"Payload"}, 0, 8 * 2); + $type = hex(substr($app_data, 0, 2)); + while ($app_data ne "") { + printf " %s", substr($app_data, 0, 2); + $app_data = substr($app_data, 2); + } } # Extra data - if ($resp{TransferType} == 2 || $resp{"Endpoint"} != 0x80) { if ($type > 128) { printf " <<<"; @@ -486,7 +489,8 @@ sub decode_frame($) { ($frame_id, $frame{"Type"}, $frame{"TransferType"}, $frame{"Endpoint"}, $frame{"Device"}, $frame{"BusID"}, - $setuprequest, $hasdata, $tsSecHigh, $tsSecLow, $tsUsec, + $frame{"SetupFlag"}, $frame{"DataFlag"}, + $tsSecHigh, $tsSecLow, $tsUsec, $frame{"Status"}, $frame{"URBLength"}, $frame{"DataLength"}) = unpack("A8CCCCvCCVVVlVV", $strdata); $frame{"ID"} = "0x"; |