diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-02-26 15:30:48 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-02-26 15:30:48 -0300 |
commit | 5e0ad401330f23a6524c745b133e32b9d04a7ecd (patch) | |
tree | f29870a33ee33bac6b90772ae78714ddce47fbfe /v4l2-apps/util | |
parent | b83e521a82f61e3457c258da93f43ceae36daec3 (diff) | |
download | mediapointer-dvb-s2-5e0ad401330f23a6524c745b133e32b9d04a7ecd.tar.gz mediapointer-dvb-s2-5e0ad401330f23a6524c745b133e32b9d04a7ecd.tar.bz2 |
Move parse-sniffusb2.pl to the right dir
From: Mauro Carvalho Chehab <mchehab@redhat.com>
As pointed by Cityk, this file were at the wrong place.
Priority: normal
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'v4l2-apps/util')
-rwxr-xr-x | v4l2-apps/util/parse-sniffusb2.pl | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/v4l2-apps/util/parse-sniffusb2.pl b/v4l2-apps/util/parse-sniffusb2.pl new file mode 100755 index 000000000..34406b0ea --- /dev/null +++ b/v4l2-apps/util/parse-sniffusb2.pl @@ -0,0 +1,84 @@ +#!/usr/bin/perl +# +# Author: Franklin Meng <fmeng2002@yahoo.com> +# Parser for USB snoops captured from SniffUSB 2.0. +# + +use strict; +use warnings; +use Data::Dumper; + +foreach my $curfile (@ARGV) { + parsefile($curfile); + #we can only process 1 file + exit; +} + +sub parsefile { + my $curfile = shift; + my $SetupPacket =''; + my $preS = ''; + my $TransferBuffer =''; + my $preT = ''; + my $Direction =''; + my $preD = ''; + my @tmpsplit; + my $t=0; + my $s=0; + + open(FD, $curfile) || die("Error: $!\n"); + + while(<FD>) { + chomp; + if($t==1 && /^\s+\d{8}/) { +# print $_ . "\n"; + @tmpsplit = split(/\:\s/,$_); + $TransferBuffer = $TransferBuffer . $tmpsplit[1] . " "; + } elsif($s==1 && /^\s+\d{8}/) { +# print $_ . "\n"; + @tmpsplit = split(/\:\s/,$_); + $SetupPacket = $SetupPacket . $tmpsplit[1] ; + } else { + $t=0; + $s=0; + } + if(/[<>]{3}/){ + #print out last packet if valid + if($SetupPacket) { + if($preT) { + print "$SetupPacket $preD $preT\n"; + + } else { + print "$SetupPacket $Direction $TransferBuffer\n"; + } + } +# print "$SetupPacket $Direction $TransferBuffer\n"; + #clear variables + $preT = $TransferBuffer; + $TransferBuffer = ''; + $preS = $SetupPacket; + $SetupPacket = ''; + $preD = $Direction; + $t = 0; + $s = 0; + # get direction + @tmpsplit = split(/\s+/, $_); + $Direction = $tmpsplit[2]; +# print $_ . "\n"; + } elsif(/TransferBufferMDL/) { + $t = 1 + } elsif(/SetupPacket/) { + $s = 1; + } + } + #print last packet +# print "$SetupPacket $Direction $TransferBuffer\n"; + if($SetupPacket) { + if($preT) { + print "$SetupPacket $preD $preT\n"; + } else { + print "$SetupPacket $Direction $TransferBuffer\n"; + } + } +} + |