File: diff.txt

package info (click to toggle)
linux-minidisc 0.9.13-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,096 kB
  • ctags: 1,530
  • sloc: ansic: 6,345; cpp: 2,569; python: 2,451; perl: 866; sh: 22; makefile: 8
file content (173 lines) | stat: -rw-r--r-- 5,575 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
Index: logparse.pl
===================================================================
RCS file: /var/cvs/libnetmd/utilities/logparse.pl,v
retrieving revision 1.1
diff -u -r1.1 logparse.pl
--- logparse.pl	15 May 2002 21:37:14 -0000	1.1
+++ logparse.pl	17 May 2002 16:13:57 -0000
@@ -10,8 +10,9 @@
 my $PeekFlag = 0;	# Lookahead flag (ugh!)
 my $UrbTime = 0;	# Time elapsed when this URB was sent
 my $LastUrbTime = 0;	# Time elapsed when previous URB was sent
+my $FreeStyle = 0;	# Allow lines with no obvious timestamp or line tag
 
-my $LastVendor;		# Last vendor request
+my $LastVendor= '';	# Last vendor request
 
 my %UrbTypeMap = (
    'URB_FUNCTION_CONTROL_TRANSFER'		=>	'Control Transfer',
@@ -36,10 +37,10 @@
 # Main loop
 
 while( PeekLine() ) {
-    if( $Line =~ /^>>>>>>/ ) {
+    if( $Line =~ /^>>>/ ) {
 	ParseOutgoing();
     }
-    elsif( $Line =~ /^<<<<<</ ) {
+    elsif( $Line =~ /^<<</ ) {
 	ParseIncoming();
     }
     else {
@@ -57,11 +58,11 @@
 
     # Read and parse the URB direction & number header
     ReadLine() or die "Read error\n";
-    if( $Line =~ />>>>>>> URB (\d+) going down/ ) {
+    if( $Line =~ />> +URB (\d+) going down/ ) {
 	$UrbId = $1;			# Save the ID number
 	# Read and parse the URB type
 	ReadLine() or die "Read error\n";
-	if( $Line =~ /^-- (\S+):/ ) {
+	if( $Line =~ /^-- ?(\S+):/ ) {
 	    $UrbType = $1;
 	}
 	else {
@@ -88,11 +89,11 @@
 
     # Read and parse the URB direction & number header
     ReadLine() or die "Read error\n";
-    if( $Line =~ /<<<<<<< URB (\d+) coming back/ ) {
+    if( $Line =~ /<< +URB (\d+) coming back/ ) {
 	$UrbId = $1;			# Save the ID number
 	# Read and parse the URB type
 	ReadLine() or die "Read error\n";
-	if( $Line =~ /^-- (\S+):/ ) {
+	if( $Line =~ /^-- ?(\S+):/ ) {
 	    $UrbType = $1;
 	}
 	else {
@@ -114,7 +115,7 @@
 
     while( PeekLine() ) {
 	# Handle 'key = value' lines;
-	if( $Line =~ /^(.*\S)\s+=\s+(.*)/ ) {
+	if( $Line =~ /^(.*\S)\s*=\s+(.*)/ ) {
 	    my $key = $1;
 	    my $value = $2;
 	    $Params{$key} = $value;
@@ -122,6 +123,9 @@
 	    if( $value =~ /^[0-9a-f]+ \(/ ) {
 		$value =~ s/ .*//;
 	    }
+	    if( $value =~ /^00+/ ) {
+		$value =~ s/^00+/0/;
+	    }
 	    $TerseParams{$key} = $value;
 	}
 	# Handle hex data (eg transfers)
@@ -176,24 +180,24 @@
 	print "$UrbDir $UrbId $TypeName: ";
 
 	if ( $UrbType eq 'URB_FUNCTION_CONTROL_TRANSFER' ) {
-	    print "Buflen $TerseParams{'TransferBufferLength'} ";
+	    print "Buflen=$TerseParams{'TransferBufferLength'}  ";
 	    unless( $Quiet ) {
-		print "Flags $TerseParams{'TransferFlags'} ";
-		print "Pipe $TerseParams{'PipeHandle'} ";
+		print "Flags=$TerseParams{'TransferFlags'}  ";
+		print "Pipe=$TerseParams{'PipeHandle'}  ";
 	    }
 	} elsif ( $UrbType eq 'URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE' ) {
-	    print "Index $TerseParams{'Index'} ";
-	    print "Type $TerseParams{'DescriptorType'} ";
-	    print "Lang $TerseParams{'LanguageId'} ";
+	    print "Index=$TerseParams{'Index'}  ";
+	    print "Type=$TerseParams{'DescriptorType'}  ";
+	    print "Lang=$TerseParams{'LanguageId'}  ";
 	} elsif ( $UrbType eq 'URB_FUNCTION_SELECT_CONFIGURATION' ) {
 	    # Nothing here yet :)
 	} elsif ( $UrbType eq 'URB_FUNCTION_VENDOR_INTERFACE' ) {
-	    print "Req $TerseParams{'Request'} ";
+	    print "Req=$TerseParams{'Request'}  ";
 	    unless( $Quiet ) {
-		print "Value $TerseParams{'Value'} ";
-		print "Index $TerseParams{'Index'} ";
-		print "Res Bits $TerseParams{'RequestTypeReservedBits'} ";
-		print "Pipe $TerseParams{'PipeHandle'} " if( $Params{'PipeHandle'});
+		print "Value=$TerseParams{'Value'}  ";
+		print "Index=$TerseParams{'Index'}  ";
+		print "Res Bits=$TerseParams{'RequestTypeReservedBits'}  ";
+		print "Pipe=$TerseParams{'PipeHandle'}  " if( $Params{'PipeHandle'});
 	    }
 	}
 	print "\n";
@@ -235,20 +239,52 @@
     }
     while( <> ) {
 	# split out the line number and time fields
-	if( /^(\d+)\s+([0-9.]+)\s+(.*)$/ ) {
+	if( /^(\d+)\s+([0-9.]+)\s+(.*)$/ ) {	# "old" usbsnoopy format
 	    $LineNo = $1;
 	    $LineTime = $2;
 	    $Line = $3;
-	    next unless $Line;			# SKIP blank lines
-	    next if( $Line =~ /^UsbSnoop/ );	# Skip UsbSnoop internal stuff
-	    next if( $Line =~ /^\d+:\s+/ );	# Skip hexdump 'count' lines
-	    $Line =~ s/\s+$//;			# Trim trailing whitespace
 	    $Line =~ s/ : / = /g;		# Convert for easier parsing later
-	    return 1;
+	}
+	elsif( /^\[(\d+) ms\] (.*)$/ ) {	# 'new' usbsnoop format
+	    $LineTime = $1;
+	    $Line = $2;
+	    if( $LineNo ) {			# Could line numbers ourself
+		$LineNo++;
+	    }
+	    else {
+		$LineNo = 1;			# Count line number ourself
+		$FreeStyle = 1;			# Allow 'freestyle' lines
+	    }
+	}
+	elsif( $FreeStyle ) {
+	    s/^\s*//;
+	    s/^[0-9a-f]+: //;	# Nasty hack to get rid of markers in hex data
+	    $Line = $_;
+	    if( $Line =~ /^SetupPacket/ ) {
+		# Even nastier hack for the way setup packets are dumped
+		my $t = <>;
+		if( $t ) {
+		    $t =~ s/^\s*//;
+		    $t =~ s/\s+$//;
+		    $t =~ s/^[0-9a-f]+: //;
+		    $Line = "$Line $t";
+		}
+	    }
+	    $LineNo++;
 	}
 	else {
 	    die "Parse error!";
 	}
+	next unless $Line;			# SKIP blank lines
+	$Line =~ s/^\s*//;			# Trim leading whitespace
+	$Line =~ s/\s+$//;			# Trim trailing whitespace
+	next if( $Line =~ /^UsbSnoop/ );	# Skip UsbSnoop internal stuff
+	next if( $Line =~ /^fido=/ );
+	next if( $Line =~ /^fdo=/ );
+	next if( $Line =~ /^pdx=/ );
+	next if( $Line =~ /^\d+:\s*$/ );	# Skip hexdump 'count' lines
+	#print "$LineNo/$LineTime '$Line'\n";
+	return 1;
     }
     $Line = undef;
     return undef;