On Tue, Jun 02, 2020 at 12:12:07AM +0000, Peter Stuge wrote: ... > The way I read composite_setup() after try_fun_setup: it calls f->setup() > when available, and that can return < 0 to stall. > > I expect that composite_setup() and thus f->setup() run when the > SETUP packet has arrived, thus before the data packet arrives, and if > composite_setup() stalls then the device/function should never see the > data packet. > > For an OUT transaction I think the host controller might still send > the DATA packet, but the device controllers that I know don't make it > visible to the application in that case. ... Are you guys interested in comments from other people who know more about the kernel and how it works with USB? Your messages have been far too long to go into in any detail, but I will address this one issue. The USB protocol forbids a device from sending a STALL response to a SETUP packet. The only valid response is ACK. Thus, there is no way to prevent the host from sending its DATA packet for a control-OUT transfer. A gadget driver can STALL in response to a control-OUT data packet, but only before it has seen the packet. Once the driver knows what the data packet contains, the gadget API doesn't provide any way to STALL the status stage. There has been a proposal to change the API to make this possible, but so far it hasn't gone forward. Alan Stern _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel