usb: kbd: don't use int xfers when polling via ctrl xfers
authorStephen Warren <swarren@nvidia.com>
Fri, 13 Nov 2015 20:34:09 +0000 (13:34 -0700)
committerMarek Vasut <marex@denx.de>
Thu, 17 Dec 2015 20:54:41 +0000 (21:54 +0100)
When CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP is enabled, use a
GET_REPORT control transfer to retrieve the initial state of the
keyboard. This matches the technique used to poll the keyboard state.
This is useful since it eliminates the remaining use of interrupt
transfers from the USB keyboard driver, which allows it to work with
USB HCD that don't support interrupt transfers.

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
common/usb_kbd.c

index 069fbd2de7d848d7f1b29c19f0be4b2a0fef959d..9617a4848ad3b0d2dd3fd82d787403ccb6287b4b 100644 (file)
@@ -476,6 +476,9 @@ static int usb_kbd_probe_dev(struct usb_device *dev, unsigned int ifnum)
                                      USB_KBD_BOOT_REPORT_SIZE, data->new,
                                      data->intinterval);
        if (!data->intq) {
+#elif defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP)
+       if (usb_get_report(dev, iface->desc.bInterfaceNumber,
+                          1, 0, data->new, USB_KBD_BOOT_REPORT_SIZE) < 0) {
 #else
        if (usb_submit_int_msg(dev, data->intpipe, data->new, data->intpktsize,
                               data->intinterval) < 0) {