On Thu, 8 Feb 2007, Oliver Neukum wrote:

> > 1) reduces to 2) with x = 0.  So let's concentrate on 2).  The "when idle"  
> > part is solved by adding the USB_DF_DEVICE_BUSY flag, leaving only the
> > "delay = x" part.  You want this delay to be per-interface, and you want
> > it to be settable by the user.  I'm not so sure this is a good 
> > combination.
> 
> I insist on settability by the user.

Agreed.

> The granularity is debateable.

Along with the details of how it should be implemented...

> > A simple approach is to use a single device-wide inactivity delay of 20 
> > seconds.  This won't be optimal; it doesn't handle situations where the 
> > mouse has been idle for a long time while the keyboard gets used.  But at 
> > least it's correct.  Futhermore it doesn't require the user to specify 
> > two different delay values -- it would be one device, one delay.
> 
> We go to considerable lengths to present interfaces as devices. Each
> interface would be its own input device to user space. We should not
> make it important which logical devices are grouped together physically.

Taken to its logical conclusion, your argument says that the inactivity
delay shouldn't be set at the USB layer at all -- it should be set at the
input layer and propagated up somehow.

> > A more complicated approach is to keep track of the activity level of each
> > interface separately.  Apparently this is what you're in favor of, but it
> > would involve considerably more work.  We would have to store the last
> > time each interface was used (a jiffies value, not just an activity flag).  
> > Deciding when the inactivity timer should expire would involve a
> > non-trivial computation.
> 
> Only if you insist on the precision. You could simply check every interface's
> flag if you are willing to lose a bit of precision. But you'd set a correct 
> timer
> next time.

Let's see if I've got this straight.  You want each interface to have its
own autosuspend_delay value (settable via sysfs) and its own DEVICE_BUSY
bitflag.  You want the workqueue routine to go through the list of
active interfaces and for each one check whether

        autosuspend_delay > 0 && test_and_clear_bit(DEVICE_BUSY, ...) == 0

where autosuspend_delay <= 0 means the user wants the interface never to
be autosuspended.  If any of the test_and_clear_bit() checks fail, you
want the routine to set the next timeout to the maximum of the
corresponding autosuspend_delay values.

All this in addition to the standard device-wide autosuspend delay, which
will also be settable via sysfs.  The initial timeout value should be set 
to the maximum of the device-wide delay and the interface delays.

Is that right?

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