- # Now get the subvendor & subdevice portion by searching
- # parts[5:] of the lspci output. Note that we have to skip
- # the portions of the lspci output string that indicate
- # revision info.
-
- # parse in subvendorid
- subvendorindex = -1
- for i in range(5,len(parts)):
- p = self.remove_quotes(parts[i])
- if p[0] != '-':
- subvendorindex = i
- break
-
- if subvendorindex != -1:
- try:
- subvendorid= self.remove_quotes(parts[subvendorindex])
- subvendorid= long(subvendorid,16)
- except IndexError:
- print( "Skipping invalid line:", string.strip(line) )
- continue
- except ValueError, e:
- print( "Skipping invalid line:", string.strip(line) )
- continue
-
- # parse in subdeviceid
- subdeviceindex = -1
- for i in range(subvendorindex+1,len(parts)):
- p = self.remove_quotes(parts[i])
- if p[0] != '-':
- subdeviceindex = i
- break
- if subdeviceindex != -1:
- error_msg = "Skipping invalid subdeviceid:"
- try:
- subdeviceid= self.remove_quotes(parts[subdeviceindex])
- subdeviceid= long(subdeviceid,16)
- except IndexError:
- print( error_msg, string.strip(line) )
- continue
- except ValueError, e:
- print( error_msg, string.strip(line) )
- continue
-
- # search for driver that most closely matches the full_id
- # to drivers that can handle any subvendor/subdevice
- # version of the hardware.
- full_ids = ((vendorid,deviceid,subvendorid,subdeviceid),
- (vendorid,deviceid,subvendorid,self.PCI_ANY),
- (vendorid,deviceid,self.PCI_ANY,self.PCI_ANY))
-
- for full_id in full_ids:
- module = all_pci_ids.get(full_id, None)
- if module is not None:
- if classid == self.PCI_CLASS_NETWORK_ETHERNET:
- network_mods.append(module[0])
- elif classid in (self.PCI_CLASS_STORAGE_SCSI,
- self.PCI_CLASS_STORAGE_RAID,
- self.PCI_CLASS_STORAGE_OTHER,
- self.PCI_CLASS_STORAGE_IDE):
- scsi_mods.append(module[0])
- break
-
- system_mods[self.MODULE_CLASS_SCSI]= scsi_mods
- system_mods[self.MODULE_CLASS_NETWORK]= network_mods
-
- return system_mods