You are not logged in.

#1 2008-07-28 11:51:31

coolaman
Member
From: france
Registered: 2008-07-28
Posts: 34
Website

Laptop-script

I made a little bash script for laptop to manage acpi events like lid closed, laptop on battery, laptop inactivity, etc ...

The main idea is to control exactly the actions too take when we are on battery or on sector. It's like a mix of laptop-mode-tools and gnome-power-manager but more flexible. You can extend this by adding new rules ( for example what to do when the power button is pressed .)

Depends :  acpi ( or Hal, or Upower, as you want ) , kernel's module acpi-cpufreq, cpufrequtils  ( You don't need acpid or laptop-mode-tools )

If you use pm-utils >= 1.4, it override laptop-script configuration on resume.

Defaults rules :
- On ac  :
    * Governor cpu ondemand, normal screensaver.
- On battery :
    * Governor cpu conservative , shutdown screen after 5 minutes.
    * If battery less than 15%, the governor becomes powersave.
    * hibernate after 900s of inactivity and below 5% battery remaining.
      * If no battery present, governor cpu on demand.
- On program exception :
    * shut down screensaver and governor on demand, no other change are made.
    * If battery less than 15%, the governor becomes powersave.
- Closing screen :
    * shut down screen on AC
    * Hibernate on battery

Look inside the script to put your own rules and powersavings tips. Don't forget to read the installation document.

If you want to try : PKGBUILD

PS : Sorry for my poor english.

Last edited by coolaman (2010-07-05 15:11:18)

Offline

#2 2008-11-27 21:17:55

coolaman
Member
From: france
Registered: 2008-07-28
Posts: 34
Website

Re: Laptop-script

Update of the script :

- Less power consomption .
- Some litlles bugs fix.

Offline

#3 2008-11-28 02:33:59

honahursey
Member
Registered: 2008-08-18
Posts: 32

Re: Laptop-script

I would try using the ondemand cpu govenor on battery, it uses less power than the others.  See www.lesswatts.org for more info if your curious.

Offline

#4 2008-11-30 16:09:45

coolaman
Member
From: france
Registered: 2008-07-28
Posts: 34
Website

Re: Laptop-script

It's easy to remove the governor. Look in the script and remove line 80, 118,137 to 140,181 to 184 and add :
echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor on line 40.

With this, only ondemand governor will be available ( both on battery and ac ).

I will test ondemand governor later on my laptop.

One question for you: I see in one of your post that you use acpi-cpufreq-phc. I try it but i can't see if it work ( battery life is still the same without it ). How can i see if it work ?

Thanks.

Offline

#5 2008-11-30 20:20:00

wirenik
Member
Registered: 2008-08-22
Posts: 134

Re: Laptop-script

Coolaman, this is AWESOME. Five stars, just what I was looking for!


moljac024: No one really knows what happens inside /dev/null... it could be a gateway to another universe....
dunc: If it is, the people who live there must be getting pretty annoyed by now with all the junk we send them.

Offline

#6 2009-01-29 15:43:03

coolaman
Member
From: france
Registered: 2008-07-28
Posts: 34
Website

Re: Laptop-script

A little update :

- Correction of the bug which prevents the computer to hibernate with exception

wirenik wrote:

Coolaman, this is AWESOME. Five stars, just what I was looking for!

Thanks . I'm happy that this script is useful for you

Last edited by coolaman (2009-01-29 15:43:50)

Offline

#7 2009-04-22 07:17:50

coolaman
Member
From: france
Registered: 2008-07-28
Posts: 34
Website

Re: Laptop-script

Update :

Corrections:
- If no battery present when booting, hibernate computer
- Auto suspend if there is no activities don't work.

Offline

#8 2009-04-22 19:11:50

NeoXP
Member
From: MS Matrix
Registered: 2009-01-09
Posts: 206
Website

Re: Laptop-script

I've read the readme and the script, but I think this script will not work with a Core 2 Duo.

Has anyone tried it?

Would it work if I change line 85 from:

echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

to

echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor && echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor

And so for all the lines regarding CPU?


Arch x86_64 on HP 6820s and on HP nx9420. Registered Linux User 350155, since 24-03-2004
"Everyone said that it could not be done, until someone came along who didn't know that."

Offline

#9 2009-04-22 20:10:43

wankel
Member
From: Iowa, USA
Registered: 2008-05-30
Posts: 218
Website

Re: Laptop-script

NeoXP wrote:

I've read the readme and the script, but I think this script will not work with a Core 2 Duo.

Has anyone tried it?

Would it work if I change line 85 from:

echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

to

echo "ondemand" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor && echo "ondemand" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor

And so for all the lines regarding CPU?

I think whatever you do to cpu0 will also affect cpu1. So it should work, but im not 100% positive on this one.

Offline

#10 2009-04-25 14:23:42

NeoXP
Member
From: MS Matrix
Registered: 2009-01-09
Posts: 206
Website

Re: Laptop-script

Got it working now, but without CPU Governor. After second thoughts I don't need it at all.


Arch x86_64 on HP 6820s and on HP nx9420. Registered Linux User 350155, since 24-03-2004
"Everyone said that it could not be done, until someone came along who didn't know that."

Offline

#11 2010-06-24 04:34:05

coolaman
Member
From: france
Registered: 2008-07-28
Posts: 34
Website

Re: Laptop-script

I have rewrite the script to be more simpler and flexible.

If you find bugs or ameliorations, please tell me.

Last edited by coolaman (2010-07-05 15:12:23)

Offline

Board footer

Powered by FluxBB