On Tue, 12 Jul 2005, Dave Mielke wrote:

> Is it normal for the first user-space bulk write to a bulk output endpoint of 
> a
> freshly opened usbfs file gets lost? This problem seems to have occurred on
> every kernel I can remember, although, in case it's important, the one I'm
> currently using is 2.6.12-1.1390_FC4smp. Is there something I'm supposed to do
> in order to properly prepare the endpoint for output before doing bulk writes
> to it? Thanks.

It's not normal, and in general there isn't anything you need to do to
prepare an endpoint.

Lost writes can happen, however, if the device and the host disagree about
the state of the endpoint's data toggle.  The data toggle is supposed to
be reset whenever the device is reset, so if nothing has touched the bulk
endpoint from the time the device was plugged in then there should be no
disagreement.

On the other hand, there are known examples where loading a driver,
unloading it, and then loading it again will cause just such a
disagreement to occur.  When a driver is unloaded, usbcore sends a
Set-Interface request to the device.  This should set the toggle back to
0, but on some faulty devices it doesn't.  So if the toggle was equal to
1, and the device failed to set it to 0, and the host thinks it is equal
to 0, the stage is now set for a lost write.

With usbfs, claiming and releasing an interface (or closing the device 
file) are equivalent to loading and unloading a driver.  Hence it's 
possible that you're seeing this phenomenon.

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

Reply via email to