RE: [PATCH] usb: gadget: zero: fix INT endpoint assignment

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

 



> From: Sebastian Andrzej Siewior [mailto:bigeasy@xxxxxxxxxxxxx]
> Sent: Tuesday, November 25, 2014 9:22 AM
> 
> The max packet size within the FS descriptor has to be highest possible
> value and _not_ the one that is (or will be) used on FS.
> The way the code works (since day 1) is that usb_ep_autoconfig() is
> invoked _only_ on the FS endpoint and then the endpoint address is
> copies over to HS/SS endpoints. If the any of the "critical" options are
> different between FS and HS then we have to pass the HS value and
> correct later.
> 
> What now happens is that we look for an INT-OUT endpoint of 64bytes. The
> code will return an endpoint matching this category. Further the
> sourcesink will take this endpoint and increase the MPS to 1024. On
> net2280 for instance the code tries to be clever to return an endpoint
> which can only do 64 MPS. The same happens on musb where we mostlike get
> an endpoint which can only do 512. The result is then on the host side:
> 
> |~# testusb -a -t 9 -c 2
> |unknown speed   /dev/bus/usb/002/045    0
> |usbtest 2-1:3.0: TEST 9:  ch9 (subset) control tests, 2 times
> |usbtest 2-1:3.0: can't set_interface = 2, -32
> |usbtest 2-1:3.0: ch9 subset failed, iterations left 1
> |/dev/bus/usb/002/045 test 9 --> 32 (Broken pipe)
> 
> because the on the gadget side we can't enable the endpoint because
> desc->size > ep->max_size.
> 
> Fixes: ef11982dd7a6 ("usb: gadget: zero: Add support for interrupt EP")
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> ---
>  drivers/usb/gadget/function/f_sourcesink.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/usb/gadget/function/f_sourcesink.c b/drivers/usb/gadget/function/f_sourcesink.c
> index 80be25b32cd7..7d8f0216e1a6 100644
> --- a/drivers/usb/gadget/function/f_sourcesink.c
> +++ b/drivers/usb/gadget/function/f_sourcesink.c
> @@ -161,7 +161,7 @@ static struct usb_endpoint_descriptor fs_int_source_desc = {
> 
>  	.bEndpointAddress =	USB_DIR_IN,
>  	.bmAttributes =		USB_ENDPOINT_XFER_INT,
> -	.wMaxPacketSize =	cpu_to_le16(64),
> +	.wMaxPacketSize =	cpu_to_le16(1024),

This seems strange. You are setting the max packet size in the FS Intr
endpoint descriptor to a value that is illegal for FS. Won't that cause
usb_ep_autoconfig() to fail if the UDC only has a FS Intr endpoint?

Maybe you should set wMaxPacketSize to 0 instead? The ep_matches()
function in epautoconf.c has this code:
	/*
	 * If the protocol driver hasn't yet decided on wMaxPacketSize
	 * and wants to know the maximum possible, provide the info.
	 */
	if (desc->wMaxPacketSize == 0)
		desc->wMaxPacketSize = cpu_to_le16(ep->maxpacket_limit);

-- 
Paul

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux