|
From: Alan S. <st...@ro...> - 2012-01-17 19:49:47
|
On Tue, 17 Jan 2012, Johannes Stezenbach wrote: > On Tue, Jan 17, 2012 at 11:42:45AM -0500, Alan Stern wrote: > > On Tue, 17 Jan 2012, Johannes Stezenbach wrote: > > > > > On Tue, Jan 17, 2012 at 10:42:53AM -0500, Alan Stern wrote: > > > > On Tue, 17 Jan 2012, Johannes Stezenbach wrote: > > > > > > > > > > Among other things, SET_CONFIGURATION resets the data toggle of > > > > > the endpoint to DATA0. > > > > > > > > Why would anybody want to do that? Isn't it easier and simpler just to > > > > keep using the endpoint's current data toggle value? > > > > > > USB spec section 9.1.1.5 "Configured" requires it. > > > > You misunderstood. I wasn't asking why you would want to put the > > device into the Configured state; I was asking why you would want to > > reset the endpoint's data toggle. > > 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. > > 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). Alan Stern |