On Thu, 29 Dec 2005, jinzhucheng wrote: > Maybe, this question is similar with my question ("about status stage > response" few days ago. > > we can't see how usb device module can responds with either NAK or STALL > in status stage from udc driver and gadget driver if function cannot > complete the command. > > maybe, in ep_queue function, when we ack the IN token of the control-out > transfer's status stage, we can decide if send zero-length packet or > NAK/STALl by value which returned from ep0_complete function.
That's not right. The ep0_complete function doesn't return anything. If the gedget driver's setup() function returns a negative error code then the controller driver should respond to the status stage with a STALL. Otherwise the controller driver must respond with NAK. For a control-out transfer, the gadget driver's setup() function should call usb_ep_queue() to receive the data sent by the host. The ep0_complete function can call usb_ep_set_halt() to send a STALL, or else it should try to carry out the command. I don't know exactly when the status stage ACK gets sent, or how the gadget driver should indicate that the command failed. In the file storage gadget this issue never comes up. Likewise, I don't know how the controller driver is supposed to handle the OUT transaction of a control-in status stage. Maybe the driver should NAK until ep0_complete() returns and then send ACK. Alan Stern ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel