summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2004-10-21 21:08:01 +0000
committerBill Nottingham <notting@redhat.com>2004-10-21 21:08:01 +0000
commitf88dfe40466ed949052fae52587dd100259f8c06 (patch)
tree553f1fd7ef911463a919389771451d40e7368383 /utils
parent9e6b9e68829f6e77dd8905f0802bdb31ca56bcbf (diff)
downloadanaconda-f88dfe40466ed949052fae52587dd100259f8c06.tar.gz
anaconda-f88dfe40466ed949052fae52587dd100259f8c06.tar.xz
anaconda-f88dfe40466ed949052fae52587dd100259f8c06.zip
add pciid trimming here
Diffstat (limited to 'utils')
-rw-r--r--utils/Makefile1
-rwxr-xr-xutils/trimpciids51
2 files changed, 52 insertions, 0 deletions
diff --git a/utils/Makefile b/utils/Makefile
index f9727c5ea..d8dba43ab 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -51,6 +51,7 @@ install: all
install -m755 genhdlist $(DESTDIR)/$(RUNTIMEDIR)
install -m755 trimpcitable $(DESTDIR)/$(RUNTIMEDIR)
install -m755 trimmodmap $(DESTDIR)/$(RUNTIMEDIR)
+ install -m755 trimpciids $(DESTDIR)/$(RUNTIMEDIR)
install -m755 trimusbmap $(DESTDIR)/$(RUNTIMEDIR)
install -m755 moddeps $(DESTDIR)/$(RUNTIMEDIR)
install -m755 filtermoddeps $(DESTDIR)/$(RUNTIMEDIR)
diff --git a/utils/trimpciids b/utils/trimpciids
new file mode 100755
index 000000000..3274dc2cf
--- /dev/null
+++ b/utils/trimpciids
@@ -0,0 +1,51 @@
+#!/usr/bin/python
+
+import sys
+import os
+import string
+
+vendors = []
+devices = []
+
+f = open(sys.argv[1])
+if f:
+ pcitable = f.readlines()
+ f.close()
+ for line in pcitable:
+ if not line.startswith("0x"):
+ continue
+ fields = line.split('\t')
+ if fields[0] not in vendors:
+ vendors.append(fields[0])
+ if (fields[0], fields[1]) not in devices:
+ devices.append( (fields[0],fields[1]))
+f = open(sys.argv[2])
+if f:
+ pcimap = f.readlines()
+ f.close()
+ for line in pcimap:
+ if line.startswith("#"):
+ continue
+ ( trash, vend, dev, trash, trash, trash , trash, trash ) = line.split()
+ vend = vend.replace("0x0000","0x",1)
+ dev = dev.replace("0x0000","0x",1)
+ if vend not in vendors:
+ vendors.append(vend)
+ if (vend,dev) not in devices:
+ devices.append( (vend, dev))
+
+pciids = sys.stdin.readlines()
+current_vend = 0
+for line in pciids:
+ if line.startswith("#") or line == "\n":
+ continue
+ if line.startswith("\t\t"):
+ continue
+ if not line.startswith("\t"):
+ current_vend = "0x%s" % line.split()[0]
+ if current_vend in vendors:
+ print line,
+ continue
+ dev = "0x%s" % line.split()[0]
+ if (current_vend, dev) in devices:
+ print line,