From 7dc65d2507f27059f1c48301ceda63a575f155d2 Mon Sep 17 00:00:00 2001 From: Vincent Palatin Date: Tue, 17 Jan 2012 18:05:51 -0800 Subject: 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 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 Tested-by: Vincent Palatin Reviewed-by: Stefan Reinauer (cherry picked from commit 012bbf0ce0301be2482857e3f03b481dd15c2340) Reviewed-on: https://gerrit.chromium.org/gerrit/14379 --- common/usb_kbd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/common/usb_kbd.c b/common/usb_kbd.c index 04832b32279..cb471b9d309 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; -- cgit v1.2.3