-
- # now find the .ko and get list of supported vendor/dev-ids
- modpath = find_module(mod)
- if modpath is None:
- print "Cannot find module file %s" % (mod + ".ko")
- sys.exit(1)
- depmod_output = check_output(["depmod", "-n", modpath]).splitlines()
- for line in depmod_output:
- if not line.startswith("alias"):
- continue
- if not line.endswith(mod):
- continue
- lineparts = line.split()
- if not(lineparts[1].startswith("pci:")):
- continue;
- else:
- lineparts[1] = lineparts[1][4:]
- vendor = lineparts[1][:9]
- device = lineparts[1][9:18]
- if vendor.startswith("v") and device.startswith("d"):
- module_dev_ids.append({"Vendor": int(vendor[1:],16),
- "Device": int(device[1:],16)})
-
-def is_supported_device(dev_id):
- '''return true if device is supported by igb_uio, false otherwise'''
- for dev in module_dev_ids:
- if (dev["Vendor"] == devices[dev_id]["Vendor"] and
- dev["Device"] == devices[dev_id]["Device"]):
- return True
- return False