> -----Original Message-----
> From: Alan Stern [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 14, 2005 10:01 PM
> To: Li Yang-r58472
> Cc: linux-usb-devel@lists.sourceforge.net
> Subject: RE: [linux-usb-devel] question about mass storage gadget
> 
> 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.


Seems I didn't state the problem clearly.  I agree that there is no problem 
with the mass-storage gadget driver.  But the problem becomes how to deal with 
host's clear_feature request in device controller driver.  Do we need to check 
the queue in udc when doing set_halt() for value equals either 0 or 1 as in 
omap_udc?


> 
> > > > 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


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&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

Reply via email to