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?

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?


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

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

Alan Stern


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

Reply via email to