device activity checking for powersaver on a linux laptop

Peter Hansen peter at engcorp.com
Sat Feb 1 18:16:22 EST 2003


Fabian Lienert wrote:
> 
> Dear pythonists,
> 
> I am new to python and want to write a program, that saves battery power on
> a linux laptop. For example it should power off the display, when there is no
> keyboard or mouse activity for a minute.
> 
> My first problem is: I cannot found a /dev device for the keyboard. And raw_input doesn't make sense,
> because it is like a prompt, its impossible to check for keyboard activity.

I don't know anything about using /dev stuff for what you want, but
did you know about /proc/interrupts?  That should be good for something,
and certainly indicates "activity" in some sense.  I don't know if
there are some interrupts going on even when there is no *user* activity,
but you could probably calibrate that out easily enough with a little
bit of experimentation.

-Peter




More information about the Python-list mailing list