[PATCH] usb: Add 1ms delay after first Get Descriptor request

Simon Glass sjg at chromium.org
Mon Oct 31 20:27:05 CET 2022


Hi Marek,

On Sun, 30 Oct 2022 at 16:38, Marek Vasut <marex at denx.de> wrote:
>
> Logitech Unifying Receiver 046d:c52b bcdDevice 12.10 seems
> sensitive about the first Get Descriptor request. If there
> are any other requests in the same microframe, the device
> reports bogus data, first of the descriptor parts is not
> sent to the host. Wait over one microframe duration before
> issuing subsequent requests to avoid probe failure with
> this device, since it can be used to connect USB keyboards.
>
> Signed-off-by: Marek Vasut <marex at denx.de>
> ---
> Cc: Janne Grunau <j at jannau.net>
> Cc: Mark Kettenis <kettenis at openbsd.org>
> ---
>  common/usb.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)

Is this device complying with the spec or is it broken?

In any case we need a way to enable/disable this as it will slow down
unaffected platforms.

I've also been wondering if (not with this patch) USB can move to
using the cyclic stuff to do its work, so we don't have to wait.

>
> diff --git a/common/usb.c b/common/usb.c
> index 6fcf1e8428e..ae9253dfc0e 100644
> --- a/common/usb.c
> +++ b/common/usb.c
> @@ -999,6 +999,17 @@ static int usb_setup_descriptor(struct usb_device *dev, bool do_read)
>                 err = get_descriptor_len(dev, 64, 8);
>                 if (err)
>                         return err;
> +
> +               /*
> +                * Logitech Unifying Receiver 046d:c52b bcdDevice 12.10 seems
> +                * sensitive about the first Get Descriptor request. If there
> +                * are any other requests in the same microframe, the device
> +                * reports bogus data, first of the descriptor parts is not
> +                * sent to the host. Wait over one microframe duration here
> +                * (1mS for USB 1.x , 125uS for USB 2.0) to avoid triggering
> +                * the issue.
> +                */
> +               mdelay(1);
>         }
>
>         dev->epmaxpacketin[0] = dev->descriptor.bMaxPacketSize0;
> --
> 2.35.1
>

Regards,
Simon


More information about the U-Boot mailing list