qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hw/usb/hcd-dwc2: Enforce epnum to 0 for the control endpoint


From: Gerd Hoffmann
Subject: Re: [PATCH] hw/usb/hcd-dwc2: Enforce epnum to 0 for the control endpoint to avoid the assertion failure in usb_ep_get()
Date: Wed, 21 Jul 2021 13:44:24 +0200

> > > * https://gitlab.com/qemu-project/qemu/-/issues/119
> > > * https://gitlab.com/qemu-project/qemu/-/issues/303

> diff --git a/hw/usb/core.c b/hw/usb/core.c
> index 975f762..a29b378 100644
> --- a/hw/usb/core.c
> +++ b/hw/usb/core.c
> @@ -735,10 +735,11 @@ void usb_ep_dump(USBDevice *dev)
> 
>  struct USBEndpoint *usb_ep_get(USBDevice *dev, int pid, int ep)
>  {
>      struct USBEndpoint *eps;
> 
>      assert(dev != NULL);
> -    if (ep == 0) {
> +    if (ep == 0 || pid == USB_TOKEN_SETUP) {
>          return &dev->ep_ctl;
>      }

Looks sane to me, although I'm not sure it matches what
real hardware does.

Can you submit that as proper patch (including Resolves: for the gitlab
issues fixed)?

> > message and fail the operation? AFAIK there are no real-world devices
> > that have Control endpoints other than 0, although I believe it is allowed
> > by the USB spec.

IIRC control endpoint is zero by spec.

thanks & take care,
  Gerd




reply via email to

[Prev in Thread] Current Thread [Next in Thread]