On Wed, 31 Jan 2007, Oliver Neukum wrote:

> > > Furthermore that work should be queued only if pm_usage_cnt==0,
> > > which cannot be allowed if the device isn't idle.
> > 
> > Isn't that what you want?  Surely you aren't trying to start an
> > autosuspend timer while the device is busy?
> 
> How do I find out whether the device is idle?
> The mouse is not idle if it has been moved (or buttons clicked)
> To find out whether it has been moved the device must not be suspended.
> At which point in time then should I check? Are you saying that the
> timer should be started and suspend() should fail if the devices hasn't
> been idle?

Logically speaking, the computer doesn't and can't know if the device is 
currently idle.  After all, it takes several milliseconds for the HID 
reports indicating any activity to be transferred from the device to the 
computer, so the computer's knowledge is always at least a little bit out 
of date.

So you shouldn't base any decisions on whether the device is currently
idle.  Instead, you have to check whether the device has been idle for a
sufficiently long time.  That's what the timer is for: You restart the
timer whenever there is any activity, and when the timer expires you know
the device has been idle long enough that you should suspend it.  That's
exactly how the autosuspend infrastructure works.


> > > > If the user could put usbcore.autosuspend_delay=60 on the boot command 
> > > > line, then it would be possible to prevent some devices from being 
> > > > autosuspended.
> > > 
> > > Just startup with autosuspend off.
> > 
> > There _is_ no way to turn it off, other than not setting
> > CONFIG_USB_SUSPEND -- in which case there's no way to turn it on.
> 
> I was suggesting that you introduce a setting. Before you try guessing how 
> long
> a boot will last, better start without autosuspend. If you need userspace
> intervention anyway, you can keep it simple.

Introducing a variable autosuspend delay isn't significantly more
complicated than introducing an on/off switch.  And it has the advantage
that idle devices _will_ eventually be autosuspended.  If, on the other
hand, you start with autosuspend turned off and then turn it on, none of
your idle devices will get autosuspended until some event restarts their
autosuspend timers.  You would have to run lsusb or do something similar.

Alan Stern


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
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