|
From: Johannes S. <js...@si...> - 2012-01-17 20:37:41
|
On Tue, Jan 17, 2012 at 02:49:36PM -0500, Alan Stern wrote: > On Tue, 17 Jan 2012, Johannes Stezenbach wrote: > > > > That's what I mean, 9.1.1.5 requires the data toggle reset > > when setting the configuration. > > Sorry, I can't follow what you're saying at all. > > Yes, 9.1.1.5 requires the device to reset its data toggles when it > receives a Set-Config request. That doesn't explain why you would want > to send a Set-Config request in the first place, or why you would want > to reset the data toggles. Required or not, one can send Set-Config requests as often as wanted. What matters is that the FX2 firmware needs to handle it correctly. The OP quoted this sequence of calls: libusb_set_configuration(cur_handle, 1) libusb_claim_interface(cur_handle, 0) libusb_set_interface_alt_setting(cur_handle,0,0) Thus I remembered about this issue because my libusb based driver did something similar which caused intermittent errors and eventually was tracked down as the FX2 firmware bug I'm talking about. > > > Although, come to think of it, why _would_ you want to put the device > > > into the Configured state? The only reason I can think of would be if > > > the operating system didn't already take care of that for you. > > > > It doesn't matter who calls SET_CONFIGURATION, what matters is > > that HCD and device agree, otherwise the HCD will signal > > an error. I mention it because I spent some time debugging > > FX2 firmware and this was one of the issues causing mysterious > > error returns. > > How would the HCD and the device get out of agreement to begin with? > If they agree all along, there's no reason to change the toggle > setting. > > > However, my device is self powered, if the device is bus powered > > and the configuration is set once after plug-in by the OS then you'll > > never see this issue. > > Even with a self-powered device, how would the HCD and the device get > out of agreement on a toggle value? A bug in the device firmware, > perhaps? I have noticed that many firmwares seem to have trouble > handling Set-Interface requests. They crash, or they forget to clear > the data toggles (in spite of the fact that 9.1.1.5 requires them to do > so). Hrm, this subthread _is_ about FX2 firmware bugs. FX2 does not reset the data toggles unless either the firmware does it or power is removed. Host and FX2 get out of sync when host issues SET_CONFIGURATION and thus resets its data toggle, but FX2 firmware does not. It should be noted that FX2 does not reset the data toggles by itself during enumeration or due to USB reset, it has to be handled by firmware. Thus if an FX2 device is in an active hub which does not support switching port power the issue may also arise. Johannes |