All of lore.kernel.org
 help / color / mirror / Atom feed
From: Angelo Dureghello <angelo@kernel-space.org>
To: Alan Stern <stern@rowland.harvard.edu>,
	Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: Re: testusb: epipe errors on test 9 and 10
Date: Wed, 10 Dec 2025 15:20:18 +0100	[thread overview]
Message-ID: <6ca433ef-5395-4143-8203-504f9237339e@kernel-space.org> (raw)
In-Reply-To: <06229e27-db5f-410c-8c80-39cd2a18aed7@rowland.harvard.edu>

Hi Alan,

On 12/4/25 23:26, Alan Stern wrote:
> On Tue, Dec 02, 2025 at 11:22:38PM +0000, Thinh Nguyen wrote:
>> On Tue, Dec 02, 2025, Alan Stern wrote:
>>> On Tue, Dec 02, 2025 at 04:23:13AM +0000, Thinh Nguyen wrote:
>>>> On Mon, Dec 01, 2025, Alan Stern wrote:
>>>>> Are we talking about the same thing?  Clear-Feature is different from
>>>>> Get-Interface-Status.
>>>>>
>>>> Ah... I just saw the subject line testusb -EPIPE and assumed that it's
>>>> related to ClearFeature(halt_ep)..
>>>>
>>>> The Get-Interface-Status should be hand-off and handled by gzero right?
>>>> The gadget driver knows about the status of the interface, not UDC
>>>> driver.
>>> For USB-2 devices, Get-Interface-Status is always supposed to return two
>>> bytes of 0.  For USB-3 devices, it returns information about Function
>>> Remote Wakeup and Function Remote Wakeup Capable, which is handled
>>> already by the composite core.
>>>
>>> So for SuperSpeed and above, the request should be delegated.  For high
>>> speed and below, it could be done either way.  (dummy-hcd makes the
>>> opposite mistake; it always returns zeros for Get-Interface-Status and
>>> never delegates.)
>>>
>>> If you think it's best always to delegate the request then composite.c
>>> needs to be changed; it should handle the reply for non-SuperSpeed
>>> connections.  A simple change; I can do it.  What do you prefer?
>>>
>> Right this change is simple. I think it's probably easier to delegate
>> and enforce this in the composite library instead of auditing all the
>> UDC drivers.
> Here's a patch to try.  Angelo, can you test this?
>
> Alan Stern
>
>
>
> Index: usb-devel/drivers/usb/gadget/composite.c
> ===================================================================
> --- usb-devel.orig/drivers/usb/gadget/composite.c
> +++ usb-devel/drivers/usb/gadget/composite.c
> @@ -1966,25 +1966,27 @@ composite_setup(struct usb_gadget *gadge
>   			break;
>   		}
>   
> -		/*
> -		 * USB 3.0 additions:
> -		 * Function driver should handle get_status request. If such cb
> -		 * wasn't supplied we respond with default value = 0
> -		 * Note: function driver should supply such cb only for the
> -		 * first interface of the function
> -		 */
> -		if (!gadget_is_superspeed(gadget))
> -			goto unknown;
> +		/* UDC driver should handle device and endpoint recipients */
>   		if (ctrl->bRequestType != (USB_DIR_IN | USB_RECIP_INTERFACE))
>   			goto unknown;
> -		value = 2;	/* This is the length of the get_status reply */
> -		put_unaligned_le16(0, req->buf);
>   		if (!cdev->config || intf >= MAX_CONFIG_INTERFACES)
>   			break;
>   		f = cdev->config->interface[intf];
>   		if (!f)
>   			break;
>   
> +		value = 2;	/* This is the length of the get_status reply */
> +		put_unaligned_le16(0, req->buf);
> +		if (!gadget_is_superspeed(gadget))
> +			break;	/* USB-2 always returns zeros */
> +
> +		/*
> +		 * USB 3.0 additions:
> +		 * Function driver should handle get_status request. If such cb
> +		 * wasn't supplied we respond with default value = 0
> +		 * Note: function driver should supply such cb only for the
> +		 * first interface of the function
> +		 */
>   		if (f->get_status) {
>   			status = f->get_status(f);
>   
thanks a lot.

I am actually stuck working in 5-4 kernel, where the issue was detected, 
but will do my best to test this
as soon as i can .

Regards,
angelo



      reply	other threads:[~2025-12-10 14:26 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-27  8:06 testusb: epipe errors on test 9 and 10 Angelo Dureghello
2025-11-27  8:22 ` Greg KH
2025-11-27 12:53   ` Angelo Dureghello
2025-11-27 13:21     ` Greg KH
2025-11-28  3:23 ` Alan Stern
2025-11-28 14:20   ` Angelo Dureghello
2025-11-28 15:20     ` Alan Stern
2025-11-28 16:10       ` Alan Stern
2025-11-28 21:21         ` Angelo Dureghello
2025-12-01 23:29         ` Thinh Nguyen
2025-12-02  3:09           ` Alan Stern
2025-12-02  4:23             ` Thinh Nguyen
2025-12-02 16:25               ` Alan Stern
2025-12-02 23:22                 ` Thinh Nguyen
2025-12-04 22:26                   ` Alan Stern
2025-12-10 14:20                     ` Angelo Dureghello [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6ca433ef-5395-4143-8203-504f9237339e@kernel-space.org \
    --to=angelo@kernel-space.org \
    --cc=Thinh.Nguyen@synopsys.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.