summaryrefslogtreecommitdiffstats
path: root/convert
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-02-16 16:58:08 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-02-16 16:58:08 +0000
commitb46f95668473ec553f0750b181145a4933c78413 (patch)
tree26789ef186600eec19246e93a6ff1b5edb8598c0 /convert
parentb6d65e93dd05699013efc8a5a0ac5e3ae3563632 (diff)
downloadldetect-lst-b46f95668473ec553f0750b181145a4933c78413.tar
ldetect-lst-b46f95668473ec553f0750b181145a4933c78413.tar.gz
ldetect-lst-b46f95668473ec553f0750b181145a4933c78413.tar.bz2
ldetect-lst-b46f95668473ec553f0750b181145a4933c78413.tar.xz
ldetect-lst-b46f95668473ec553f0750b181145a4933c78413.zip
add merging with SuSE hwinfo
Diffstat (limited to 'convert')
-rw-r--r--convert/README.pcitable5
-rwxr-xr-xconvert/merge2pcitable.pl42
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;