diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2007-09-08 14:57:15 -0400 |
---|---|---|
committer | Michael Krufky <mkrufky@linuxtv.org> | 2007-09-08 14:57:15 -0400 |
commit | abc09c918e663e91b2a03b02cb15af4fa55cc4c8 (patch) | |
tree | 71eacc1cdb31a2c3419ff99bcee8ef42f625e1d6 | |
parent | d1c13402d0c6dedd352fd44b20a24c4e9cbab543 (diff) | |
download | mediapointer-dvb-s2-abc09c918e663e91b2a03b02cb15af4fa55cc4c8.tar.gz mediapointer-dvb-s2-abc09c918e663e91b2a03b02cb15af4fa55cc4c8.tar.bz2 |
cx23885: add cardlist generator script
From: Michael Krufky <mkrufky@linuxtv.org>
based on cx88.pl -- minimal changes required for cx23885
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
-rwxr-xr-x | v4l/scripts/cardlist | 2 | ||||
-rw-r--r-- | v4l/scripts/cx23885.pl | 57 |
2 files changed, 59 insertions, 0 deletions
diff --git a/v4l/scripts/cardlist b/v4l/scripts/cardlist index 0225d6ebd..0f25a4b81 100755 --- a/v4l/scripts/cardlist +++ b/v4l/scripts/cardlist @@ -18,3 +18,5 @@ scripts/saa7134.pl ../linux/drivers/media/video/saa7134/saa7134.h ../linux/drive scripts/usbvision.pl ../linux/drivers/media/video/usbvision/usbvision-cards.h ../linux/drivers/media/video/usbvision/usbvision-cards.c \ | perl -ne 's/[ \t]+$//; print' > ../linux/Documentation/video4linux/CARDLIST.usbvision +scripts/cx23885.pl ../linux/drivers/media/video/cx23885/cx23885.h ../linux/drivers/media/video/cx23885/cx23885-cards.c \ + | perl -ne 's/[ \t]+$//; print' > ../linux/Documentation/video4linux/CARDLIST.cx23885 diff --git a/v4l/scripts/cx23885.pl b/v4l/scripts/cx23885.pl new file mode 100644 index 000000000..4b3c57c86 --- /dev/null +++ b/v4l/scripts/cx23885.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+(CX23885_BOARD_\w+)\s+(\d+)/) { + $data{$1}->{nr} = $2; + next; + } + # cx88_boards + if (/\[(CX23885_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*\"([^\"]+)\"/); + } + + # cx88_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"; +} |