Subject: Re: power management and idle detection on non-x86
To: Steven M. Bellovin <smb@cs.columbia.edu>
From: Michael Lorenz <macallan@netbsd.org>
List: tech-kern
Date: 05/07/2006 16:23:53
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

>> I've been working to get some sort of power management into my
>> sparcbook for a while now and apart from powerhooks in many device
>> drivers there are a few other things missing.
>> First, we need a way to know when the machine is idle so we can dim
>> backlight at some point, or fall asleep. What I'd like to have is a
>> bunch of 'idle timers' - just write the current timestamp into a more
>> or less global variable whenever the mouse is moved, some key is
>> pressed etc., probably keep different counters for different devices.
>> With this we could detect 'idleness' by just comparing these variables
>> to current time, if enough of them differ by some predefined value we
>> can take actions. On PCs this is probably handled by the APM BIOS but
>> on macppc or sparc we don't have anything like that so we need our 
>> own.
>> So, before I'm wasting my time inventing the wheel the 5th time - do 
>> we
>> have something like this somewhere in the kernel? Should it be
>> integrated with powerd? What about powerd vs. apmd? Their scopes seem
>> to overlap quite a bit.
>>
> Are you assuming X or console?

Neither. It should work no matter what you're running on top of it.

>   In X, it's handled by the X server, under control of the dpms 
> option; see xset(1).  Briefly, though, I do
>
> 	xset +dpms
>
> in my .xinitrc file, and the video driver for X turns off the 
> backlight.

I know what these controls do and on the sparcbook X is able to turn 
off the backlight as well - all it takes is the right ioctl(). This 
doesn't allow us to suspend the unit after a certain time of inactivity 
though.

> Note that the X server already knows when the mouse or keyboard have 
> been
> used.

This doesn't help.

have fun
Michael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iQEVAwUBRF5XWcpnzkX8Yg2nAQLXEwf/VRTj6P8miXuCnt7LdB9RRiWHYfHjuWrx
Bfah0csniwMrJEGQo2jDJUtulV5vphfgr1FcxVNMIW6pBNZFSg2S2tHUsGTWbGCP
lpJXZW1oZDk18VvSDqEO9Qt3CNzT/IjMQMP/K9ZhLSYDF6C+pviFmDV3uxkIc+bl
ZaRofgGOVnCKyypu+1mhiHxVYZAw00dixGNVoSZS7PMGOc7WC34H1ShOr9wHMNOa
6GtKyyHb4SOGKzLg3mPqs+lWKtpy4Jzh0jT0xgncyDFLjAeC7o1jYUN02I3X6aOW
SVN3b0/wlKvFm7zwn+uV8a2GFJL5q+hciUidcYquCwG5QFosWsbQQw==
=dYhO
-----END PGP SIGNATURE-----