When adding the ID of a composite device dynamically to a driver, all hitherto
unbound interfaces are bound to this driver which is often not intended.
The patch adds the option to tell the targeted interface class to a driver, in
addition to the device ID.
Example:
$ echo "1234 2a2a ff" >/sys/bus/usb-serial/drivers/generic/new_id
will bind only vendor-specific interfaces to usbserial.
Signed-off-by: Josua Dietze <digidietze@xxxxxxxxxxxxxxx>
-------
--- linux-3.0.4/drivers/usb/core/driver.c.orig 2011-07-22 04:17:23.000000000 +0200
+++ linux-3.0.4/drivers/usb/core/driver.c 2011-10-21 22:34:00.000000000 +0200
@@ -44,10 +44,11 @@ ssize_t usb_store_new_id(struct usb_dyni
struct usb_dynid *dynid;
u32 idVendor = 0;
u32 idProduct = 0;
+ unsigned int bInterfaceClass = 0;
int fields = 0;
int retval = 0;
- fields = sscanf(buf, "%x %x", &idVendor, &idProduct);
+ fields = sscanf(buf, "%x %x %x", &idVendor, &idProduct, &bInterfaceClass);
if (fields < 2)
return -EINVAL;
@@ -58,7 +59,11 @@ ssize_t usb_store_new_id(struct usb_dyni
INIT_LIST_HEAD(&dynid->node);
dynid->id.idVendor = idVendor;
dynid->id.idProduct = idProduct;
- dynid->id.match_flags = USB_DEVICE_ID_MATCH_DEVICE;
+ if (fields == 3) {
+ dynid->id.bInterfaceClass = (u8)bInterfaceClass;
+ dynid->id.match_flags = USB_DEVICE_ID_MATCH_DEVICE |
USB_DEVICE_ID_MATCH_INT_CLASS;
+ } else
+ dynid->id.match_flags = USB_DEVICE_ID_MATCH_DEVICE;
spin_lock(&dynids->lock);
list_add_tail(&dynid->node, &dynids->list);
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html