redesigned, now only has 2 python files (pypci and pypcimap) and no c file
[pypcilib.git] / pypci.py
index 1632bc5..6800aca 100644 (file)
--- a/pypci.py
+++ b/pypci.py
@@ -4,7 +4,7 @@ def get_devices():
     """ This is a replacement to the pypciscan library."""
 
     ret = {}
-    pci_cmd = os.popen("""/sbin/lspci -Dnvm | sed -e 's/\t/ /g' -e 's/^/"/' -e 's/$/"/' -e 's/$/,/' -e 's/^"",$/],[/'""", 'r')
+    pci_cmd = os.popen("""/sbin/lspci -nvm | sed -e 's/\t/ /g' -e 's/ Class / /' -e 's/^/"/' -e 's/$/"/' -e 's/$/,/' -e 's/^"",$/],[/'""", 'r')
     pci_str = "[" + pci_cmd.read() + "]"
     pci_list = eval(pci_str)
 
@@ -41,8 +41,8 @@ def get_devices():
         if 'svendor' in dev: subvend = dev['svendor']
         else: subvend = 0xffffffffL
 
-       if 'progif' in dev: progif = dev['progif']
-       else: progif = 0
+        if 'progif' in dev: progif = dev['progif']
+        else: progif = 0
 
         value = (dev['vendor'], dev['device'], subvend, subdev, dev['class'] << 8 | progif)
         ret[dev['deviceaddr']] = value