From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Fix USB keyboard polling via control endpoint
Date: Thu, 10 Apr 2014 10:12:42 +0200 [thread overview]
Message-ID: <201404101012.42527.marex@denx.de> (raw)
In-Reply-To: <20140406111746.25D3538099A@gemini.denx.de>
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!
next prev parent reply other threads:[~2014-04-10 8:12 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <13471364.2645.1396715619854.JavaMail.adrian@Gurnard>
2014-04-05 16:36 ` [U-Boot] [PATCH] Fix USB keyboard polling via control endpoint Adrian Cox
2014-04-06 11:17 ` Wolfgang Denk
2014-04-07 9:56 ` Adrian Cox
2014-04-07 16:59 ` Wolfgang Denk
2014-04-10 8:12 ` Marek Vasut [this message]
2014-04-10 8:49 ` Adrian Cox
2014-04-10 9:04 ` Marek Vasut
2014-04-10 10:15 ` Wolfgang Denk
2014-04-10 12:33 ` Marek Vasut
2014-04-10 13:02 ` [U-Boot] [PATCH v3] " Adrian Cox
2014-04-10 14:14 ` Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201404101012.42527.marex@denx.de \
--to=marex@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.