summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2012-01-17 18:05:51 -0800
committerGerrit <chrome-bot@google.com>2012-01-18 11:18:21 -0800
commit7dc65d2507f27059f1c48301ceda63a575f155d2 (patch)
treeecb74ee400b07905022b1bb5df22d4478d23ea9c /common
parent3f68143724b1f6d94b4605faf514a5a0798b7d46 (diff)
usb: workaround non-working keyboards.
If the USB keyboard is not answering properly the first request on its interrupt endpoint, just skip it and try the next one. This workarounds an issue with a wireless mouse dongle which presents itself both as a keyboard and a mouse but has a non-functional keyboard interface. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=chrome-os-partner:7559 TEST=Boot a stumpy with the wireless mouse and the keyboard plugged in such a way that the mouse enumerates first. Check we are booting properly and the key strokes are working in the firmware. Change-Id: I574f2a4bdb3bc7824b5bd747a237ef0b79dd83ac Reviewed-on: https://gerrit.chromium.org/gerrit/14362 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org> (cherry picked from commit 012bbf0ce0301be2482857e3f03b481dd15c2340) Reviewed-on: https://gerrit.chromium.org/gerrit/14379
Diffstat (limited to 'common')
-rw-r--r--common/usb_kbd.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 04832b3227..cb471b9d30 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -439,8 +439,13 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned int ifnum)
usb_set_idle(dev, iface->desc.bInterfaceNumber, REPEAT_RATE, 0);
USB_KBD_PRINTF("USB KBD: enable interrupt pipe...\n");
- usb_submit_int_msg(dev, pipe, data->new, maxp > 8 ? 8 : maxp,
- ep->bInterval);
+ if (usb_submit_int_msg(dev, pipe, data->new, maxp > 8 ? 8 : maxp,
+ ep->bInterval) < 0) {
+ printf("Failed to get keyboard state from device %04x:%04x\n",
+ dev->descriptor.idVendor, dev->descriptor.idProduct);
+ /* Abort, we don't want to use that non-functional keyboard. */
+ return 0;
+ }
/* Success. */
return 1;