summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Troan <ewt@redhat.com>1999-05-04 16:39:11 +0000
committerErik Troan <ewt@redhat.com>1999-05-04 16:39:11 +0000
commit5efcbfaebcc6b0854b39f2ab15dd591f675d9df2 (patch)
tree6c66011741ddbc4e0389ae4e0e16b60c0017c921
parent61ed75dc21fc8f4fbfc582438f360c7fddeb4451 (diff)
downloadanaconda-5efcbfaebcc6b0854b39f2ab15dd591f675d9df2.tar.gz
anaconda-5efcbfaebcc6b0854b39f2ab15dd591f675d9df2.tar.xz
anaconda-5efcbfaebcc6b0854b39f2ab15dd591f675d9df2.zip
oops
-rwxr-xr-xisys/pci/mergeids112
1 files changed, 112 insertions, 0 deletions
diff --git a/isys/pci/mergeids b/isys/pci/mergeids
new file mode 100755
index 000000000..0e5cdcf3c
--- /dev/null
+++ b/isys/pci/mergeids
@@ -0,0 +1,112 @@
+#!/usr/bin/perl
+
+require("translations");
+
+sub sortFile {
+ my($file) = @_;
+
+ rename($file, "$file" . ".old");
+ system("sort < $file.old > $file");
+}
+
+sub parseLine {
+ my($line) = @_;
+
+ $line =~ /([^|]*)\|(.*)/;
+ $class = $1;
+ $device = $2;
+ $class =~ s/ *$//;
+ $device =~ s/ *$//;
+ $name = $class . "|" . $device;
+
+ return $name;
+}
+
+sortFile(unsupported);
+sortFile(video);
+
+open(F, "<unsupported");
+while (<F>) {
+ chop;
+ if (/^#/) { next };
+ $unsupported{parseLine($_)} = 1;
+}
+close(F);
+
+open(F, "<video");
+while (<F>) {
+ chop;
+ if (/^#/) { next };
+ $unsupported{parseLine($_)} = 1;
+}
+close(F);
+
+open(F, "<kernel");
+while (<F>) {
+ chop;
+ if (/^#/) { next };
+ s/ *$//;
+ if (!length($_)) { next };
+
+ if (/^[A-Za-z0-9]/) {
+ $driver = $_;
+ } else {
+ s/^[ \t]+//;
+ $drivers{parseLine($_)} = $driver;
+ }
+}
+
+open(F, "<pci.ids");
+open(UNKNOWN, ">unknown");
+open(DRIVERS, ">driverlist.h");
+
+print DRIVERS "struct pciDrivers pciDriverList[] = {\n";
+
+$class = "";
+$gotunknown = 0;
+
+while (<F>) {
+ chop;
+ s/ */ /g;
+ s/^ *//g;
+ s/ *$//g;
+ if (/^#.*/) { next };
+ if (!length($_)) { next };
+
+ if (/^\t/) {
+ if ($class eq "") {
+ die "unexpected device\n";
+ }
+ s/\t([0-9A-Fa-f]+) +//;
+ $devid = $1;
+
+ $name = $class . "|" . $_;
+ if ($unsupported{$name}) {
+ } elsif ($drivers{$name}) {
+ printf(DRIVERS "\t{ 0x%s, 0x%s, \"%s\"},\n", $classid, $devid,
+ $drivers{$name});
+ } else {
+ printf(UNKNOWN "%-25s|%s\n", $class, $_);
+ $gotunknown = 1;
+ }
+ } else {
+ s/([0-9A-Fa-f]+) +//;
+ $classid = $1;
+ if ($classtr{$_}) {
+ $class = $classtr{$_};
+ } else {
+ $class = $_;
+ }
+ }
+}
+
+close(F);
+
+print DRIVERS "};\n";
+
+if ($gotunknown) {
+ print "Go read the unsupported file and move those entries to better locations!\n";
+ exit 1
+} else {
+ unlink("unknown");
+}