X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=pypciscan.c;h=24b81a990b67a686ab3c40d0ebea93cee5b49bc5;hb=a16bc11651fcc68a8bf41c5447882177026420f0;hp=02087d6552d3c13722b1c0fdd2ff131096699f8b;hpb=a27148070fb16a9c3a80c066c0a0dd10cf1b8074;p=pypcilib.git diff --git a/pypciscan.c b/pypciscan.c index 02087d6..24b81a9 100644 --- a/pypciscan.c +++ b/pypciscan.c @@ -60,16 +60,18 @@ static PyObject *get_devices(PyObject *self, PyObject *args) for (dev = pacc->devices; dev; dev = dev->next) { u16 subvendor = -1, subdevice = -1; PyObject *value; + u8 progif = 0; pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_CLASS); if (dev->hdrtype == PCI_HEADER_TYPE_NORMAL) { subvendor = pci_read_word(dev, PCI_SUBSYSTEM_VENDOR_ID); subdevice = pci_read_word(dev, PCI_SUBSYSTEM_ID); } + progif = pci_read_byte(dev, PCI_CLASS_PROG); snprintf(buf, sizeof(buf), "%04x:%02x:%02x.%02x", dev->domain, dev->bus, dev->dev, dev->func); value = Py_BuildValue("iiiii", dev->vendor_id, dev->device_id, - subdevice, subvendor, dev->device_class); + subvendor, subdevice, dev->device_class << 8 | progif); if (!value) return NULL; if (PyDict_SetItemString(ret, buf, value) == -1)