summaryrefslogtreecommitdiff
path: root/v4l/scripts/usbvision.pl
blob: 5aae512c5f367b86b48b45901610e6e5f0072bcd (plain)
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
#!/usr/bin/perl -w
use strict;

my $new_entry = -1;
my $nr = 0;
my ($id,$subvendor,$subdevice);
my %data;

my $cap=0;

while (<>) {
	if (m/usbvision_device_data/) {
		$cap=1;
		next;
	}
	if (m/usbvision_table/) {
		$cap=0;
		next;
	}
	if ($cap==0) {
		next;
	}

	if (m/\{0x([0-9a-z]...)\s*\,\s*0x([0-9a-z]...).*\"(.*)\"/) {
		$data{$nr}->{nr} = $nr;
		$data{$nr}->{name} = $3;
		push @{$data{$nr}->{subid}}, "$1:$2";
		$nr++;
	}
}

foreach my $item (sort { $data{$a}->{nr} <=> $data{$b}->{nr} } keys %data) {
	printf("%3d -> %-56s", $data{$item}->{nr}, $data{$item}->{name});
	printf(" [%s]",join(",",@{$data{$item}->{subid}}))
	  if defined($data{$item}->{subid});
	print "\n";
}