+ # a common user error is to forget to specify the driver the devices need to
+ # be bound to. check if the driver is a valid device, and if it is, show
+ # a meaningful error.
+ try:
+ dev_id_from_dev_name(driver)
+ # if we've made it this far, this means that the "driver" was a valid
+ # device string, so it's probably not a valid driver name.
+ sys.exit("Error: Driver '%s' does not look like a valid driver. " \
+ "Did you forget to specify the driver to bind devices to?" % driver)
+ except ValueError:
+ # driver generated error - it's not a valid device ID, so all is well
+ pass
+
+ # check if we're attempting to bind to a driver that isn't loaded
+ if not module_is_loaded(driver):
+ sys.exit("Error: Driver '%s' is not loaded." % driver)
+
+ try:
+ dev_list = map(dev_id_from_dev_name, dev_list)
+ except ValueError as ex:
+ sys.exit(ex)