diff options
author | Sebastian Bauer <mail@sebastianbauer.info> | 2011-07-21 09:40:07 -0400 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2011-08-01 15:06:47 -0400 |
commit | c240d78a8f9b1d4e1d391203f4a698117fae3474 (patch) | |
tree | 1ce018de133e5b9c3aacba9465e526d268dfb0b2 /drivers | |
parent | b61ae3427086ea413aa1fb35feea9e8c4d7c2584 (diff) |
usb: gadget: hid: don't STALL when processing a HID Descriptor request
This is a patch to fix an issue with the HID gadget which, at the moment,
returns STALL on a HID descriptor request. Essentially, the patch changes
the hid gadget such that a request for the HID descriptor is handled by
copying the descriptor into the response buffer, rather than falling
through the default case, in which the request is answered by a STALL.
Signed-off-by: Sebastian Bauer <mail@sebastianbauer.info>
Acked-by: Peter Korsgaard <peter.korsgaard@barco.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/f_hid.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/gadget/f_hid.c b/drivers/usb/gadget/f_hid.c index 403a48bcf560..83a266bdb40e 100644 --- a/drivers/usb/gadget/f_hid.c +++ b/drivers/usb/gadget/f_hid.c | |||
@@ -367,6 +367,13 @@ static int hidg_setup(struct usb_function *f, | |||
367 | case ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8 | 367 | case ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE) << 8 |
368 | | USB_REQ_GET_DESCRIPTOR): | 368 | | USB_REQ_GET_DESCRIPTOR): |
369 | switch (value >> 8) { | 369 | switch (value >> 8) { |
370 | case HID_DT_HID: | ||
371 | VDBG(cdev, "USB_REQ_GET_DESCRIPTOR: HID\n"); | ||
372 | length = min_t(unsigned short, length, | ||
373 | hidg_desc.bLength); | ||
374 | memcpy(req->buf, &hidg_desc, length); | ||
375 | goto respond; | ||
376 | break; | ||
370 | case HID_DT_REPORT: | 377 | case HID_DT_REPORT: |
371 | VDBG(cdev, "USB_REQ_GET_DESCRIPTOR: REPORT\n"); | 378 | VDBG(cdev, "USB_REQ_GET_DESCRIPTOR: REPORT\n"); |
372 | length = min_t(unsigned short, length, | 379 | length = min_t(unsigned short, length, |