in pci_lib/pci_lib.py [0:0]
def express_type(self):
"""
@return PCI-Express device type, None if this is a PCI device.
"""
with closing(PCIConfigSpace.get(self.device_name)) as config:
express = find_capability(config, PCI_CAP_EXPRESS)
if express is None:
return None
flags = read_u16(config, express + PCI_CAP_FLAGS)
exptype = EXPRESS_TYPES.get((flags & 0xf0) >> 4)
return exptype