Alan, > > On Thu, 4 Jan 2007, Mike King wrote: > > > > > > > Anytime a SET_CONFIGURATION is sent to the device without being > > > > > > preceeded > > > > > > by the secret vendor specific command the device reverts to the > > > > > > previous > > > > > > device descriptor data indicating 100ma. > > When you say "preceeded by", do you mean "immediately preceeded by"? How > long a time, and what other requests, are allowed to come between the > secret command and the Set-Config? What if there are two consecutive > Set-Configs -- will the second one cause the device to revert?
What I see with the analyzer is that the secret command immediately preceeds the set-config. And, yes, a second set-config causes the device to restore the power-on default device descriptor indicating 100ma. > > BTW, it's very unusual -- bordering on illegal -- for a device to change > the contents of its configuration descriptor without re-enumerating. Are > you sure it really does this? Or does it leave the descriptor the same > (500 mA) but revert to drawing only 100 mA of current? I'm sure it does this as I'm watching with a hardware analyzer (Finisar Bus Doctor). In terms of actual current draw, I don't know. I don't have a current probe to see what is happening. I do know that on the display it will say "insufficient charging current" if it has not gone thru this secret command / set-config sequence. > > > > > The settling time is only necessary after the secret command and the > > > SET_CONFIGURATION. The device resets itself and is coming out of reset > > Note: You say the device "resets" itself, but you really mean that it > disconnects itself from the USB bus and then reconnects. That's different > from a reset. Thanks for correcting me. I am still trying to teach myself about USB devices as well as the Linux USB implementation. What the analyzer indicates is a reset. Here is the full sequence as shown by the Finisar : GET_DESCRIPTOR DEVICE SET_ADDRESS GET_DESCRIPTOR DEVICE GET_DESCRIPTOR CONFIG (9 bytes) bMaxPower = 100ma 0x09 0x02 0x2e 0x00 0x01 0x01 0x00 0x80 0x32 GET_DESCRIPTOR CONFIG (full config) GET_DESCRIPTOR STRING (repeated 4 times with different indexes) CLASS_SPECIFIC CMD (secret command) value=0, index=1, length=0 SET_CONFIGURATION config value = 1,index=0,length=0 reset reset reset GET_DESCRIPTOR DEVICE SET_ADDRESS GET_DESCRIPTOR DEVICE GET_DESCRIPTOR CONFIG (9 bytes) bMaxPower = 500ma, all other settings are same as previous 0x09 0x02 0x2e 0x00 0x01 0x01 0x00 0x80 0xfa GET_DESCRIPTOR CONFIG (full config) GET_DESCRIPTOR STRING (repeated 4 times with different indexes) SET_CONFIGURATION config value = 1, index=0,length=0 BULK BULK BULK ... ... ... ad infinitum > > > Hi, > > > > maybe I am dense. On Windows you see: > > > > secret command -> SET_CONFIGURATION -> {device resets by itself} -> > > SET_CONFIGURATION >> 500 mA > > > > don't you? If so, I am suggesting you do: > > > > secret command -> usb_reset_device() -> {device is reset by the hub} -> > > SET_CONFIGURATION (from normal probe) > > > > I am speculating that the device firmware has code like: > > > > switch (command) { > > case SECRET_COMMAND: > > reset_upon_set_config = 1; > > full_power = 1; > > break; > > case SET_CONFIGURATION: > > if (reset_upon_set_config) { > > reset(); > > } else { > > set_config(); > > } > > > > So it might not matter how the reset is done. > > When is full_power cleared? If it gets cleared at the end of the > SET_CONFIGURATION case then you will have the following sequence: > > secret command (reset_upon_set_config = full_power = 1) > > Set Configuration (Does a disconnect & reset, turns on full power > mode, and does reset_upon_set_config = full_power = 0) > > Re-enumerate (Reads 500 mA power usage in the new descriptor) > > Device recharges its battery but is unusable because it is in > the unconfigured state > > Set Configuration (Now the device is usable but it has reverted > to 100 mA since full_power was 0) > > This doesn't seem to square with what Mike wrote earlier. > > You should note also that in this situation it won't help to call > usb_reset_device() from the probe routine. You still won't be able to > avoid the Set Configuration request after the reset completes. Full power is never cleared. The device stays in this state as long as it is connected. > > Alan Stern > Thanks, Mike P.S. Alan, I also forgot to thank you for a previous response to my question "Are endpoint addresses unique". Many thanks for that response as well. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel