[U-Boot] [PATCH] usb: kbd: don't use int xfers when polling via ctrl xfers

Hans de Goede hdegoede at redhat.com
Sun Nov 15 20:40:45 CET 2015


Hi,

On 11/13/2015 09:34 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren at nvidia.com>
>
> 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 at redhat.com>
> Signed-off-by: Stephen Warren <swarren at nvidia.com>
> ---
> Are there any disadvantages to using control transfers over interrupt
> transfers? I'm not aware of any, but I assume there must be a reason
> that U-Boot typically uses interrupt transfers.

I know of at least 2 issues with using control transfers, and IMHO we
should try to just remove support for control transfers from the usb
kbd drivers.

The 2 known issues are:

1) I've some cheap wireless keyboards where the usb-dongle does not
support the ctrl method of polling and things simply do not work
when using it.

2) My USB+DVI kvm switch will report keys as pressed to all connected
machines, even those without focus when using the ctrl method (this makes
sense since other control methods must work without focus to keep the
os on the machine happy).

Regards,

Hans


> ---
>   common/usb_kbd.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/common/usb_kbd.c b/common/usb_kbd.c
> index 95912f99c767..81c4d62c632b 100644
> --- a/common/usb_kbd.c
> +++ b/common/usb_kbd.c
> @@ -475,6 +475,9 @@ static int usb_kbd_probe(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) {
>


More information about the U-Boot mailing list