diff options
-rw-r--r-- | convert/README.pcitable | 5 | ||||
-rwxr-xr-x | convert/merge2pcitable.pl | 42 |
2 files changed, 47 insertions, 0 deletions
diff --git a/convert/README.pcitable b/convert/README.pcitable index 97a8c3cf..591f41d9 100644 --- a/convert/README.pcitable +++ b/convert/README.pcitable @@ -29,6 +29,11 @@ rm -f pcids.htm ; wget http://www.begent.co.uk/pcids.htm # with redhat's pcitable in /tmp/rh_pcitable (from hwdata) ./merge2pcitable.pl rhpcitable /tmp/rh_pcitable pcitable > pcitable.new +# with SuSE hwinfo +# (srpm in ftp://ftp.suse.com/pub/suse/i386/current/suse/src) +./merge2pcitable.pl hwinfo_x11 /tmp/hwinfo-9.31/src/ids/src/x11.i386 pcitable > pcitable.new + + # with a new kernel (cd ~/tmp ; rm -rf lib ; rpm2cpio /RPMS/kernel-2.4.*.rpm |cpio -id './lib/modules/*/modules.*map') cp -f ~/tmp/lib/modules/*/modules.{pci,usb}map . diff --git a/convert/merge2pcitable.pl b/convert/merge2pcitable.pl index 3efb5d51..7ae47fa9 100755 --- a/convert/merge2pcitable.pl +++ b/convert/merge2pcitable.pl @@ -215,6 +215,48 @@ sub read_hwd { \%drivers; } +sub read_hwinfo_x11 { + my ($f) = @_; + + my (%drivers, %e, %vendors, $line); + foreach (cat_($f)) { + $line++; + s/\s*$//; + if (my ($add, $name, $val) = /^([ &])(\w+)\.id\s+(.*)/) { + if (!$add) { + warn "read_hwinfo_x11:$line: unused %e\n" if %e; + %e = (); + } + if ($val =~ /^pci\s+0x([0-9a-f]{4})/i) { + $val = hex $1; + } else { + warn "read_hwinfo_x11:$line: weird value $val\n"; + } + $e{$name} = $val; + } elsif (/^\+vendor\.name\s+(.*)/) { + $vendors{$e{vendor}} = $1; + } elsif (/^\+(?:sub)?device\.name\s+(.*)/) { + $e{name} = $1; + } elsif (my ($driver) = /^\+driver\.xfree\s+(.*)/) { + if (exists $e{vendor} && exists $e{device}) { + my $vendor = $vendors{$e{vendor}}; + my $module = $driver =~ /^4\|(\w+)/ ? "Driver:$1" : "Card:$driver"; + $drivers{sprintf qq(%04x%04x%04x%04x), $e{vendor}, $e{device}, + $e{subvendor} || 0xffff, $e{subdevice} || 0xffff} = [ $module, "$vendor|$e{name}" ]; + } else { + warn "read_hwinfo_x11:$line: $driver but no vendor or no device\n"; + } + } elsif (/^$/) { + %e = (); + } elsif (/^\+driver\.xfree\.config/) { + # drop + } else { + warn "read_hwinfo_x11:$line: unknown line $_\n"; + } + } + \%drivers; +} + sub read_begent_pcids_htm { my ($f) = @_; my %drivers; |