On Thu, 14 Jul 2005, Li Yang-r58472 wrote: > Ok. Let's change the situation to that client reply shorter DATA than > host CBW requested. There will be a stall and CSW.
Yes, that happens normally. > > > At this time, the bulk-in ep is halted, there is a CSW request queued in > > > the bulk-in ep, and clear_feature can't be executed as the queue is not > > > empty. They form a dead-lock, and stop working. > > > > You're a little confused. Above you mentioned that set_halt fails if the > > queue is non-empty, which is correct. Here you state that clear_halt > > fails if the queue is non-empty, and that's wrong. > > I think it's reasonable to check the queue doing set_halt while ignore > it when clear_halt. However, looking into set_halt function in omap udc > driver, it returns -EAGAIN when the queue is not empty for both > set_halt/clear_halt operations. > It should have been tested, which makes me really confused. You're still mixed up. The gadget driver does call the set_halt function, but it doesn't call clear_halt. The Clear-Halt message is sent by the host and handled directly by the controller driver. The gadget driver isn't involved. > > > How did we do to avoid such a situation? Or to break it? > > > > You might ask more generally: What happens if the gadget driver tries to > > halt the bulk-in endpoint when there is data in the queue and the host > > isn't reading it? Answer: The gadget will hang until the host issues > > either a class-specific reset or a USB port reset. > > Yes, that's the phenomenon I got when the clear_halt hangs. Host keep > resetting once for a while. What clear_halt are you talking about? The only calls to clear_halt in file_storage.c occur in the handle_exceptions routine, which calls usb_ep_fifo_flush first. So the queues will be empty when clear_halt is called. Alan Stern ------------------------------------------------------- This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual core and dual graphics technology at this free one hour event hosted by HP, AMD, and NVIDIA. To register visit http://www.hp.com/go/dualwebinar _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel