diff options
-rw-r--r-- | Documentation/ABI/testing/sysfs-bus-usb | 25 | ||||
-rw-r--r-- | drivers/usb/core/driver.c | 8 |
2 files changed, 32 insertions, 1 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb index e647378e9e88..b4f548792e32 100644 --- a/Documentation/ABI/testing/sysfs-bus-usb +++ b/Documentation/ABI/testing/sysfs-bus-usb | |||
@@ -119,6 +119,31 @@ Description: | |||
119 | Write a 1 to force the device to disconnect | 119 | Write a 1 to force the device to disconnect |
120 | (equivalent to unplugging a wired USB device). | 120 | (equivalent to unplugging a wired USB device). |
121 | 121 | ||
122 | What: /sys/bus/usb/drivers/.../new_id | ||
123 | Date: October 2011 | ||
124 | Contact: linux-usb@vger.kernel.org | ||
125 | Description: | ||
126 | Writing a device ID to this file will attempt to | ||
127 | dynamically add a new device ID to a USB device driver. | ||
128 | This may allow the driver to support more hardware than | ||
129 | was included in the driver's static device ID support | ||
130 | table at compile time. The format for the device ID is: | ||
131 | idVendor idProduct bInterfaceClass. | ||
132 | The vendor ID and device ID fields are required, the | ||
133 | interface class is optional. | ||
134 | Upon successfully adding an ID, the driver will probe | ||
135 | for the device and attempt to bind to it. For example: | ||
136 | # echo "8086 10f5" > /sys/bus/usb/drivers/foo/new_id | ||
137 | |||
138 | What: /sys/bus/usb-serial/drivers/.../new_id | ||
139 | Date: October 2011 | ||
140 | Contact: linux-usb@vger.kernel.org | ||
141 | Description: | ||
142 | For serial USB drivers, this attribute appears under the | ||
143 | extra bus folder "usb-serial" in sysfs; apart from that | ||
144 | difference, all descriptions from the entry | ||
145 | "/sys/bus/usb/drivers/.../new_id" apply. | ||
146 | |||
122 | What: /sys/bus/usb/drivers/.../remove_id | 147 | What: /sys/bus/usb/drivers/.../remove_id |
123 | Date: November 2009 | 148 | Date: November 2009 |
124 | Contact: CHENG Renquan <rqcheng@smu.edu.sg> | 149 | Contact: CHENG Renquan <rqcheng@smu.edu.sg> |
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); |