How to change CPU governor automatically on a laptop

Asked by A.Kromic

How could I make the system changing the CPU governor automatically depending on the power source used? E.g. "Conservative" for battery and "Performance" for AC.

I used to do it when I was using Debian on a laptop by instaling powersaved and setting it in its configuration files. I was wondering if i could do it without disturbing the default Ubuntu power management configuration by deinstalling current power management programs and installing others. Are there any configuration options I could use now, with default PM configuration?

Thanks,
Arny

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Bhavani Shankar
Solved:
Last query:
Last reply:
Revision history for this message
Best Bhavani Shankar (bhavi) said :
#1

hmm not sure about automatic

refer this link

http://ubuntuforums.org/showthread.php?t=522078

Revision history for this message
A.Kromic (akromic) said :
#2

The mentioned thread really does offer two solutions for my question. The easier one is using gconf (the M$ registry-like abomination), and another (more unix-style) using acpi scripts.

I'll try now the gconf solution and see if the result works satisfactorily. I've changed the governors in gconf, but it has no effect, perhaps the gnome power manager needs restart? I'll see if it works on next reboot. The keys are different here in Intrepid than they were in the thread, they're under /apps/gnome-power-manager/cpufreq, policy_ac and policy_battery.

Bhavani Shankar, thanks for the link!

Revision history for this message
A.Kromic (akromic) said :
#3

gconf didn't seem to work, so I created /etc/acpi/ac.d and /etc/acpi/battery.d 99-*.sh scripts. That does work as expected. Note: there is no need for sudo command in scripts as described on the forum.

Revision history for this message
A.Kromic (akromic) said :
#4

Thanks Bhavani Shankar, that solved my question.

Revision history for this message
A.Kromic (akromic) said :
#5

One caveat though... the scripts work only on power source change. Therefore after boot, the governor is the default one, "ondemand", since no power event has occured. Not that it matters much (I don't boot very often ;), when a power event does occur it changes to the right governor, and I can still change it manually if really necessary.

Would be better if it worked perfectly though...