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: contrib: add a script to convert usbmon captures to usbsnoop Author: Aapo Tahkola <[email protected]> Date: Wed Oct 10 09:39:19 2012 -0300 This makes it possible to reuse tools written for usbsnoop with captures done using a virtual machine and usbmon. Signed-off-by: Aapo Tahkola <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]> contrib/usbmon2usbsnoop.pl | 53 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 53 insertions(+), 0 deletions(-) --- http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=6a90348360270963a076be59118153f36eea5368 diff --git a/contrib/usbmon2usbsnoop.pl b/contrib/usbmon2usbsnoop.pl new file mode 100644 index 0000000..c656687 --- /dev/null +++ b/contrib/usbmon2usbsnoop.pl @@ -0,0 +1,53 @@ +#!/usr/bin/perl +# +# This perl script converts output from usbmon to a format (usbsnoop's log format) that is compatible with usbreplay. +# Taken from http://www.linuxtv.org/wiki/index.php/Usbmon2usbsnoop + +sub print_bytes{ + my($str) = @_; + + @str_1 = split(/ /, $str); + + foreach(@str_1){ + if (length($_) == 8) { + print substr($_, 0, 2) . " " . substr($_, 2, 2) . " " . substr($_, 4, 2) . " " . substr($_, 6, 2); + }elsif(length($_) == 4) { + print substr($_, 2, 2) . " " . substr($_, 0, 2); + }elsif(length($_) == 2) { + print $_; + }elsif(length($_) == 1) { + next; + } + print " "; + } +} + + +$i = 0; +while($line = <STDIN>) { + $i++; + + if($line =~ m/\S+ \S+ \S+ \S+ \S+ (.+) \S+ </) { + printf "%06d: OUT: %06d ms %06d ms ", $i, 1, $i; + print_bytes($1); + print "<<< "; + $line = <STDIN>; + $i++; + if($line =~ m/\S+ \S+ \S+ \S+ [a-fA-F0-9 ]+ = ([a-fA-F0-9 ]+)/) { + print_bytes($1); + #print "\n"; + #print " $1\n"; + } + print "\n"; + }elsif($line =~ m/\S+ \S+ \S+ \S+ ([a-fA-F0-9 ]+) [a-fA-F0-9]+ = ([a-fA-F0-9 ]+)/) { + printf "%06d: OUT: %06d ms %06d ms ", $i, 1, $i; + print_bytes($1); + print ">>> "; + print_bytes($2); + print "\n"; + }elsif($line =~ m/\S+ \S+ \S+ \S+ s (.+)/) { + printf "%06d: OUT: %06d ms %06d ms ", $i, 1, $i; + print_bytes($1); + print ">>>\n"; + } +} _______________________________________________ linuxtv-commits mailing list [email protected] http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
