[U-Boot] [PATCH] Fix USB keyboard polling via control endpoint
Marek Vasut
marex at denx.de
Thu Apr 10 10:12:42 CEST 2014
On Sunday, April 06, 2014 at 01:17:46 PM, Wolfgang Denk wrote:
[...]
> @@ -131,7 +133,9 @@ void usb_kbd_generic_poll(void)
> /* Submit a interrupt transfer request */
> maxp = usb_maxpacket(usb_kbd_dev, pipe);
> usb_submit_int_msg(usb_kbd_dev, pipe, data->new,
> - maxp > 8 ? 8 : maxp, ep->bInterval);
> + maxp > USB_KBD_PDATA_SIZE ?
> + USB_KBD_PDATA_SIZE : maxp,
> + ep->bInterval);
Can we use min(8, USB_KBD_PDATA_SIZE) here instead of this multi-line monster
call please ?
Also, this USB_KBD_PDATA_SIZE should instead be called "USB_KBD_LS_REPORT_SIZE"
according to USB HID spec v1.11 section 5.6 :
5.6 Reports
Using USB terminology, a device may send or receive a transaction every USB
frame (1 millisecond). A transaction may be made up of multiple packets (token,
data, handshake) but is limited in size to 8 bytes for low-speed devices and 64
bytes for high-speed devices. A transfer is one or more transactions creating a
set of data that is meaningful to the device—for example, Input, Output, and
Feature reports. In this document, a transfer is synonymous with a report.
What worries me a bit is that 64-byte high-speed report, but I never saw a
device that would generate those. This section 5.6 is also the only place that
mentions the high-speed HID device report size limit.
[...]
> @@ -333,7 +340,9 @@ static inline void usb_kbd_poll_for_event(struct
> usb_device *dev) /* Submit a interrupt transfer request */
> maxp = usb_maxpacket(dev, pipe);
> usb_submit_int_msg(dev, pipe, &data->new[0],
> - maxp > 8 ? 8 : maxp, ep->bInterval);
> + maxp > USB_KBD_PDATA_SIZE ?
> + USB_KBD_PDATA_SIZE : maxp,
min(USB_KBD_LS_REPORT_SIZE, maxp) would be nice.
> + ep->bInterval);
>
> usb_kbd_irq_worker(dev);
> #elif defined(CONFIG_SYS_USB_EVENT_POLL_VIA_CONTROL_EP)
[...]
> @@ -459,7 +469,9 @@ static int usb_kbd_probe(struct usb_device *dev,
> unsigned int ifnum) usb_set_idle(dev, iface->desc.bInterfaceNumber,
> REPEAT_RATE, 0);
>
> debug("USB KBD: enable interrupt pipe...\n");
> - if (usb_submit_int_msg(dev, pipe, data->new, maxp > 8 ? 8 : maxp,
> + if (usb_submit_int_msg(dev, pipe, data->new,
> + maxp > USB_KBD_PDATA_SIZE ?
> + USB_KBD_PDATA_SIZE : maxp,
Here as well.
Other than that, I don't see a problem.
Thank you!
More information about the U-Boot
mailing list