From: Michael Tremer Date: Sun, 28 Nov 2010 19:21:14 +0000 (+0100) Subject: Add subsystem vendor and model for PCI devices. X-Git-Tag: v0.3~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=976797755ab7bff682f47dfa953a3a336a7281f2;p=oddments%2Ffireinfo.git Add subsystem vendor and model for PCI devices. --- diff --git a/fireinfo/device.py b/fireinfo/device.py index 8d48017..4502711 100644 --- a/fireinfo/device.py +++ b/fireinfo/device.py @@ -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" diff --git a/fireinfo/system.py b/fireinfo/system.py index 836e8db..a0fc25c 100644 --- a/fireinfo/system.py +++ b/fireinfo/system.py @@ -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,