Re: [PATCH v4] USB: gadget: epautoconf: fix ep maxpacket check

From: Alan Stern
Date: Thu Oct 03 2013 - 10:20:20 EST


On Thu, 3 Oct 2013, Robert Baldyga wrote:

> > This disagrees with the kerneldoc for usb_ep_autoconfig(). For bulk
> > endpoints, wMaxPacket is always supposed to be set to the full-speed
> > value, regardless of what the protocol driver specifies.
>
> Hmm, it looks like all gadgets calls usb_ep_autoconfig() for full speed
> descriptors and after it they uses usb_assign_descriptors() function to
> set descriptors proper for device speed.

Also, the gadgets have the wMaxPacketSize value hard-coded for the HS
and SS descriptors.

> And it works until gadget sets
> full speed descriptors. But what if gadget supports only high speed and
> don't want to set full speed descriptors? If it will use
> usb_ep_autoconfig() function for high speed descriptor, value of
> wMaxPacketSize field will change to 64. Is there any good solution for
> this problem or all gadgets have to support full speed?

The gadget driver can change wMaxPacketSize back to the correct value
after calling usb_ep_autoconfig().

Or you can change the definition of usb_ep_autoconfig(), and have the
driver pass the speed value as an additional argument.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/