Re: patch to autosuspend mice

Alan Stern <[email protected]>
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Wed, 31 Jan 2007, Oliver Neukum wrote:

> Hi,
> 
> this preliminary patch should suspend your mouse, if it supports remote
> wakeup. In fact it should do this to all devices which are HID, claimed by
> the input layer and support remote wakeup.
> 
> It works for me with my mouse. I've tested letting it autosuspend and
> resume. It survives going to a text console, init 3 and hotplugging.
> Anything else is untested. I think it'll crash and burn with PID devices.
> I am working on that.
> 
> I am pretty sure that it actually goes to sleep taking the root hub with it.
> I'd be interested in knowing how much power it really saves. Short of
> running dry my laptop's battery I have no way of telling.
> 
> You need to compile with EXPERIMENTAL & USB_SUSPEND.
> 
> 	Regards
> 		Oliver

This looks more complicated than it should be.  In particular, the 
addition of a new "idle" timer should not be needed.

We already have an autosuspend timer: the one embedded in the autosuspend
delayed_work struct inside struct usb_device.  What you really want to do
is make the delay configurable per-device instead of relying on a fixed
constant USB_AUTOSUSPEND_DELAY.  Doing things that way would remove a
tremendous amount of complexity from your patch.

In fact, I have already been considering making USB_AUTOSUSPEND_DELAY and 
module parameter for usbcore.  The idea is this: Some device must not be 
autosuspended.  Maybe the device can't handle it, maybe its upstream hub 
doesn't work right,...  There's even the case of a broken BIOS which 
unilaterally restarts a suspended EHCI controller!

Anyway, userspace has to be able to tell the kernel not to suspend these 
devices, _before_ the default autosuspend has already kicked in.  At 
boot-up time this can't be done; userspace is too busy with start-up tasks 
and other initializations and 2 seconds is just not enough time.

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.

Alan Stern

P.S.: Nowadays we're supposed to use DEFINE_SPINLOCK().


-------------------------------------------------------------------------
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
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.