diff options
Diffstat (limited to 'v4l/scripts/saa7134.pl')
-rw-r--r-- | v4l/scripts/saa7134.pl | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/v4l/scripts/saa7134.pl b/v4l/scripts/saa7134.pl new file mode 100644 index 000000000..789d1c851 --- /dev/null +++ b/v4l/scripts/saa7134.pl @@ -0,0 +1,53 @@ +#!/usr/bin/perl -w +use strict; + +my %map = ( + "PCI_ANY_ID" => "0", + "PCI_VENDOR_ID_PHILIPS" => "1131", +); + +sub fix_id($) { + my $id = shift; + $id = $map{$id} if defined($map{$id}); + $id =~ s/^0x//; + return $id; +} + +my $new_entry = -1; +my $nr = 0; +my ($id,$subvendor,$subdevice); +my %data; + +while (<>) { + # saa7134_boards + if (/\[(SAA7134_BOARD_\w+)\]/) { + $id = $1; + $data{$id}->{id} = $id; + $data{$id}->{nr} = $nr++; + }; + next unless defined($id); + + if (!defined($data{$id}) || !defined($data{$id}->{name})) { + $data{$id}->{name} = $1 if (/\.name\s*=\s*\"([^\"]+)\"/); + } + + # saa7134_pci_tbl + $subvendor = fix_id($1) if (/\.subvendor\s*=\s*(\w+),/); + $subdevice = fix_id($1) if (/\.subdevice\s*=\s*(\w+),/); + if (/.driver_data\s*=\s*(\w+),/) { + if (defined($data{$1}) && + defined($subvendor) && $subvendor ne "0" && + defined($subdevice) && $subdevice ne "0") { + push @{$data{$1}->{subid}}, "$subvendor:$subdevice"; + undef $subvendor; + undef $subdevice; + } + } +} + +foreach my $item (sort { $data{$a}->{nr} <=> $data{$b}->{nr} } keys %data) { + printf("%3d -> %-40s", $data{$item}->{nr}, $data{$item}->{name}); + printf(" [%s]",join(",",@{$data{$item}->{subid}})) + if defined($data{$item}->{subid}); + print "\n"; +} |