- if subdeviceindex != -1:
- try:
- subdeviceid= self.remove_quotes(parts[subdeviceindex])
- subdeviceid= long(subdeviceid,16)
- except IndexError:
- print( "Skipping invalid line:", string.strip(line) )
- continue
- except ValueError, e:
- print( "Skipping invalid line:", string.strip(line) )
- continue
-
- full_id= (vendorid,deviceid,subvendorid,subdeviceid)
- module = all_pci_ids.get(full_id, None)
- if module is None:
- continue
-
- if classid == self.PCI_CLASS_NETWORK:
- network_mods.append(module[0])
- elif classid in (self.PCI_CLASS_RAID,
- self.PCI_CLASS_RAID2,
- self.PCI_CLASS_IDE):
- scsi_mods.append(module[0])
+ 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