aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorJosua Dietze <digidietze@draisberghof.de>2011-10-23 08:22:29 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-11-15 13:18:29 -0500
commitff231db811803ef3292532d1d87eaf6882a26cc4 (patch)
treec200ed75706d3b42970d7693dbfbd6c790207714 /drivers/usb
parent332960bd7eb48ef21923b4876e7fe3487d6bf11c (diff)
USB: Add optional match for interface class to dynamic ID facility
When adding the ID of a composite device dynamically to a driver, all hitherto unbound interfaces are bound to this driver regardless of their class, which may not be intended. The patch adds the option to tell the targeted interface class to a driver via the "new_id" attribute, in addition to the device ID. Also, it appends the ABI documentation accordingly. Example: $ echo "1234 2a2a ff" >/sys/bus/usb-serial/drivers/option1/new_id will bind only vendor-specific interfaces to the 3G driver. Signed-off-by: Josua Dietze <digidietze@draisberghof.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/core/driver.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c
index 45887a0ff873..73abd8a0647d 100644
--- a/drivers/usb/core/driver.c
+++ b/drivers/usb/core/driver.c
@@ -45,10 +45,12 @@ ssize_t usb_store_new_id(struct usb_dynids *dynids,
45 struct usb_dynid *dynid; 45 struct usb_dynid *dynid;
46 u32 idVendor = 0; 46 u32 idVendor = 0;
47 u32 idProduct = 0; 47 u32 idProduct = 0;
48 unsigned int bInterfaceClass = 0;
48 int fields = 0; 49 int fields = 0;
49 int retval = 0; 50 int retval = 0;
50 51
51 fields = sscanf(buf, "%x %x", &idVendor, &idProduct); 52 fields = sscanf(buf, "%x %x %x", &idVendor, &idProduct,
53 &bInterfaceClass);
52 if (fields < 2) 54 if (fields < 2)
53 return -EINVAL; 55 return -EINVAL;
54 56
@@ -60,6 +62,10 @@ ssize_t usb_store_new_id(struct usb_dynids *dynids,
60 dynid->id.idVendor = idVendor; 62 dynid->id.idVendor = idVendor;
61 dynid->id.idProduct = idProduct; 63 dynid->id.idProduct = idProduct;
62 dynid->id.match_flags = USB_DEVICE_ID_MATCH_DEVICE; 64 dynid->id.match_flags = USB_DEVICE_ID_MATCH_DEVICE;
65 if (fields == 3) {
66 dynid->id.bInterfaceClass = (u8)bInterfaceClass;
67 dynid->id.match_flags |= USB_DEVICE_ID_MATCH_INT_CLASS;
68 }
63 69
64 spin_lock(&dynids->lock); 70 spin_lock(&dynids->lock);
65 list_add_tail(&dynid->node, &dynids->list); 71 list_add_tail(&dynid->node, &dynids->list);