On Wed, Oct 19, 2022, Wesley Cheng wrote:
On 10/18/2022 7:39 PM, Thinh Nguyen wrote:
The gadget driver may wait on the request completion when it sets the USB_GADGET_DELAYED_STATUS. Make sure that the End Transfer command can go through if the dwc->delayed_status is set so that the request can complete. When the delayed_status is set, the Setup packet is already processed, and the next phase should be either Data or Status. It's unlikely that the host would cancel the control transfer and send a new Setup packet during End Transfer command. But if that's the case, we can try again when ep0state returns to EP0_SETUP_PHASE.
Hi Thinh,
In the scenario you saw your issue in, was there something else that triggered the EP0 stall and restart to bring back EP0 to SETUP state? (which will do the retry) Just wanted to make sure, because there were situations that I had to add that sequence for the endxfer retry to happen. (ie in the disconnect interrupt)
My scenario happens while the device is connected and not related to soft-disconnect. It doesn't involve cancellation of the control transfer.
The scenario you mentioned in your change is related to soft-disconnect right?
"Ocasionally, a host may abort the current SETUP transaction, by issuing a subsequent SETUP token. In those situations, it would result in an endxfer timeout as well."
I added a check to retry End Transfer to account for the scenario you reported.
Thanks, Thinh