device activity checking for powersaver on a linux laptop
Fabian Lienert
fabian at mitlinks.ch
Sun Feb 2 10:39:23 EST 2003
I forgot to say, that I got a toshiba libretto l2 laptop, on which I
can change the brightness of the lcd display in
/proc/acpi/toshiba/lcd.
Second with longrun it is possible to set cpu activity.
So I know how to save power, but my problem is how can I check if
the laptop is idle, I mean how does my python script know, if the keyboard
and mouse wasn't used for 60 seconds for example.
thanks for help.
Fabian
jerf at compy.attbi.com wrote:
> On Sat, 01 Feb 2003 23:22:13 +0100, 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.
>
>
> Commands exist for these things already, and as a result of the commands
> existing, nobody has bothered to interface the system calls that are
> necessary to do that work to Python. Trying to do this with stock Python
> is hopeless. If you *absolutely insist* on doing this, you *must* write C
> extensions.
>
> If you want to fiddle with some of the settings, look at
>
> man xset
>
> to set some of the display parameters.
>
> man hdparm
>
> will let you set the disk spin timeouts. Other then the disk and screen, I
> am not aware of any other major power draws on a correctly-configured
> laptop. (Some early ACPI implementations would jam the cooling fan on its
> highest settings, from what I gather, but you should be able to update the
> kernel in that case.)
>
> Note that it may be flatly impossible to truly *power off* the display, as
> opposed to just blanking it. AFAIK, for instance, it is not possible to
> shut my display off without closing the lid. YMMV, but I wouldn't spend
> too much time worrying about it; if "xset dpms force off" doesn't
> completely shut power off to the screen, probably nothing will. (On my
> system, the screen goes black when I type that, but the power is still
> on.) And if it DOES power off the screen, then xset can set the timeout.
>
> Now, you can write a Python program that wraps around system calls and
> uses os.system or equivalent calls to pass commands through to the system,
> but since the desired functionality already exists in these programs I
> doubt you'll find that terribly interesting.
More information about the Python-list
mailing list