diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-17 10:23:05 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-09-17 10:23:05 -0300 |
commit | c4389d67725ce2dfd9da31a05f7b33033689b37e (patch) | |
tree | a7e998415d9b7f3980077b18926c1d33d35c8c4f /v4l/scripts/saa7164.pl | |
parent | 8a6da6023dbd9339fc8944814e85711b5e3bfd72 (diff) | |
parent | 33b0deb1ca699a4e3d5a90a4a35a2029aba91b0e (diff) | |
download | mediapointer-dvb-s2-c4389d67725ce2dfd9da31a05f7b33033689b37e.tar.gz mediapointer-dvb-s2-c4389d67725ce2dfd9da31a05f7b33033689b37e.tar.bz2 |
merge: http://udev.netup.ru/hg/v4l-dvb-commits
From: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'v4l/scripts/saa7164.pl')
-rw-r--r-- | v4l/scripts/saa7164.pl | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/v4l/scripts/saa7164.pl b/v4l/scripts/saa7164.pl new file mode 100644 index 000000000..95c5eb579 --- /dev/null +++ b/v4l/scripts/saa7164.pl @@ -0,0 +1,57 @@ +#!/usr/bin/perl -w +use strict; + +my %map = ( + "PCI_ANY_ID" => "0", +); + +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 (<>) { + # defines in header file + if (/#define\s+(SAA7164_BOARD_\w+)\s+(\d+)/) { + $data{$1}->{nr} = $2; + next; + } + # saa7164_boards + if (/\[(SAA7164_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*\"([^\"]+)\"/); + } + + # saa7164_pci_tbl + $subvendor = fix_id($1) if (/\.subvendor\s*=\s*(\w+),/); + $subdevice = fix_id($1) if (/\.subdevice\s*=\s*(\w+),/); + if (/.card\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 -> %-51s", $data{$item}->{nr}, $data{$item}->{name}); + printf(" [%s]",join(",",@{$data{$item}->{subid}})) + if defined($data{$item}->{subid}); + print "\n"; +} |