]> git.ipfire.org Git - oddments/fireinfo.git/commitdiff
Add subsystem vendor and model for PCI devices.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 28 Nov 2010 19:21:14 +0000 (20:21 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 28 Nov 2010 19:21:14 +0000 (20:21 +0100)
fireinfo/device.py
fireinfo/system.py

index 8d48017b21e7b5118fcea60c83439fc1f18d1ecf..45027112c428498f1dfcf4fbd6c4ae605ff06222 100644 (file)
@@ -30,8 +30,16 @@ class PCIDevice(Device):
        @property
        def deviceclass(self):
                return self._uevent['PCI_CLASS']
-       
-       
+
+       @property
+       def sub_vendor(self):
+               return self._uevent["PCI_SUBSYS_ID"].split(":")[0]
+
+       @property
+       def sub_model(self):
+               return self._uevent["PCI_SUBSYS_ID"].split(":")[1]
+
+
 class USBDevice(Device):
        subsystem = "usb"
        
index 836e8db8ee5e807415455df13b0f164ad089ce56..a0fc25c16b99fa2032f46cf389045f70726537ae 100644 (file)
@@ -72,13 +72,20 @@ class System(object):
 
                p["devices"] = []
                for device in self.devices:
-                       p["devices"].append({
+                       d = {
                                "subsystem" : device.subsystem.lower(), 
                                "vendor" : device.vendor.lower(), 
                                "model" : device.model.lower(), 
                                "deviceclass" : device.deviceclass
-                       })
-               
+                       }
+
+                       # PCI devices provide subsystem information, USB don't.
+                       if d["subsystem"] == "pci":
+                               d["sub_model"] = device.sub_model
+                               d["sub_vendor"] = device.sub_vendor
+
+                       p["devices"].append(d)
+
                p["cpu"] = {
                        "arch" : self.arch,
                        "vendor" : self.cpu.vendor,