summaryrefslogtreecommitdiff
path: root/v4l/scripts/hwdata.pl
diff options
context:
space:
mode:
authorNickolay V. Shmyrev <devnull@localhost>2005-06-01 15:58:53 +0000
committerNickolay V. Shmyrev <devnull@localhost>2005-06-01 15:58:53 +0000
commit422c9bca8db1feb268bef96d00f8e46080f3b272 (patch)
tree34f7310ba7e4816d6242903a0cf6fc7c5cca1b1f /v4l/scripts/hwdata.pl
parent3e37580caf15e21a62451a67a4337d38c6ff2b6a (diff)
downloadmediapointer-dvb-s2-422c9bca8db1feb268bef96d00f8e46080f3b272.tar.gz
mediapointer-dvb-s2-422c9bca8db1feb268bef96d00f8e46080f3b272.tar.bz2
Script for collect pci data from source in format of Linux PCI ID's project
Diffstat (limited to 'v4l/scripts/hwdata.pl')
-rw-r--r--v4l/scripts/hwdata.pl135
1 files changed, 135 insertions, 0 deletions
diff --git a/v4l/scripts/hwdata.pl b/v4l/scripts/hwdata.pl
new file mode 100644
index 000000000..079226e07
--- /dev/null
+++ b/v4l/scripts/hwdata.pl
@@ -0,0 +1,135 @@
+#!/usr/bin/perl -w
+
+# This script is used to generate hwdata pci info. We are going to
+# submit this data periodically to linux PCI ID's Project http://pciids.sf.net
+
+my %map = (
+ "PCI_ANY_ID" => "0",
+ "PCI_VENDOR_ID_PHILIPS" => "1131",
+ "PCI_VENDOR_ID_ASUSTEK" => "1043",
+ "PCI_VENDOR_ID_MATROX" => "102B",
+ "PCI_VENDOR_ID_ATI" => "1002",
+);
+
+sub fix_id($) {
+ my $id = shift;
+ $id = $map{$id} if defined($map{$id});
+ $id =~ s/^0x//;
+ return $id;
+}
+
+open ($input, "../saa7134-cards.c");
+
+print ("\n");
+print ("1131 Philips Semiconductors\n");
+
+my %data;
+
+while (<$input>) {
+
+ if (/\[(SAA7134_BOARD_\w+)\]/) {
+ $id = $1;
+ $data{$id}->{id} = $id;
+ $data{$id}->{subvendor} = "0";
+ };
+ next unless defined($id);
+
+ if (!defined($data{$id}) || !defined($data{$id}->{name})) {
+ $data{$id}->{name} = $1 if (/\.name\s*=\s*\"([^\"]+)\"/);
+ }
+
+ # saa7134_pci_tbl
+ $device = $1 if (/\.device\s*=\s*(\w+),/);
+ $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" &&
+ defined($device)) {
+ $data{$1}->{device} = $device;
+ $data{$1}->{subvendor} = $subvendor;
+ $data{$1}->{subdevice} = $subdevice;
+ undef $device;
+ undef $subvendor;
+ undef $subdevice;
+ }
+ }
+}
+
+sub print_cards ($) {
+ my $filter = shift;
+ foreach my $item (sort {$data{$a}->{subvendor} cmp $data{$b}->{subvendor}} keys (%data))
+ {
+ if (defined ($data{$item}->{device}) && ($data{$item}->{device} eq $filter)) {
+ printf("\t\t");
+ printf("%s %s %s", $data{$item}->{subvendor}, $data{$item}->{subdevice}, $data{$item}->{name});
+ print "\n";
+ }
+ }
+}
+
+print ("\t7130 SAA7130 Video Broadcast Decoder\n");
+print_cards ("PCI_DEVICE_ID_PHILIPS_SAA7130");
+print ("\t7133 SAA7133 Video Broadcast Decoder\n");
+print_cards ("PCI_DEVICE_ID_PHILIPS_SAA7133");
+print ("\t7134 SAA7134 Video Broadcast Decoder\n");
+print_cards ("PCI_DEVICE_ID_PHILIPS_SAA7134");
+print ("\t7135 SAA7135 Video Broadcast Decoder\n");
+print_cards ("PCI_DEVICE_ID_PHILIPS_SAA7135");
+
+open ($input, "../cx88-cards.c");
+
+%data=();
+
+while (<$input>) {
+ if (/\[(CX88_BOARD_\w+)\]/) {
+ $id = $1;
+ $data{$id}->{id} = $id;
+ $data{$id}->{subvendor} = "0";
+ };
+ next unless defined($id);
+
+ if (!defined($data{$id}) || !defined($data{$id}->{name})) {
+ $data{$id}->{name} = $1 if (/\.name\s*=\s*\"([^\"]+)\"/);
+ }
+
+ $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") {
+ $data{$1}->{subvendor} = $subvendor;
+ $data{$1}->{subdevice} = $subdevice;
+ undef $subvendor;
+ undef $subdevice;
+ }
+ }
+}
+
+print ("14f1 Conexant\n");
+print ("\t8800 CX23880/1/2/3 PCI Video and Audio Decoder\n");
+
+foreach my $item (sort {$data{$a}->{subvendor} cmp $data{$b}->{subvendor}} keys (%data))
+{
+ if (defined ($data{$item}->{subdevice}) && ($data{$item}->{subvendor} ne "0")) {
+ printf("\t\t");
+ printf("%s %s %s", $data{$item}->{subvendor}, $data{$item}->{subdevice}, $data{$item}->{name});
+ print "\n";
+ }
+}
+
+print ("109e Brooktree Corporation\n");
+print ("\t032e Bt878 Video Capture\n");
+%data=();
+
+open ($input, "../bttv-cards.c");
+while (<$input>) {
+ if (/\{\s*0x(\w{4})(\w{4}),.*\"([^\"]+)\"\s\},/)
+ {
+ printf ("\t\t%s %s %s\n", $1, $2, $3);
+ }
+}
+
+printf ("\n");