summaryrefslogtreecommitdiffstats
path: root/convert/merge2pcitable.pl
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/merge2pcitable.pl
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/merge2pcitable.pl')
-rwxr-xr-xconvert/merge2pcitable.pl42
1 files changed, 42 insertions, 0 deletions
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;