LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Using the "powersave" governor on battery and "ondemand" governor on AC power (https://www.linuxquestions.org/questions/slackware-14/using-the-powersave-governor-on-battery-and-ondemand-governor-on-ac-power-783663/)

piratesmack 01-21-2010 12:24 AM

Using the "powersave" governor on battery and "ondemand" governor on AC power
 
I want my computer to use the "ondemand" CPU frequency scaling governor when plugged in and switch to the "powersave" governor when running on battery power.

Is this possible?

gbonvehi 01-21-2010 01:19 AM

The answer is yes :)
And here's a good explanation on how to do it trough scripts: http://granapadano.blogspot.com/2009...-linux-26.html

piratesmack 01-21-2010 11:52 AM

Quote:

Originally Posted by gbonvehi (Post 3834585)
The answer is yes :)
And here's a good explanation on how to do it trough scripts: http://granapadano.blogspot.com/2009...-linux-26.html

Thanks, I'll check that out

manwichmakesameal 01-21-2010 12:30 PM

That's amazing, I was just thinking about this exact same thing the other day. I didn't really do anything about it, just thinking about it. Maybe this is a sign.....

alunduil 01-21-2010 12:42 PM

If you have KDE 4 you just need the governors in your kernel and powerdevil will start using them.

Regards,

Alunduil

piratesmack 01-21-2010 12:54 PM

Worked great. I'd prefer to use a bash script instead of python, so I came up with this.

Code:

#!/bin/sh

if grep -q 'on-line' /proc/acpi/ac_adapter/*/state; then
  GOV="ondemand"
else
  GOV="powersave"
fi

for cpu in /sys/devices/system/cpu/cpu?/cpufreq/scaling_governor; do
  echo $GOV > $cpu
done

Thanks again.


All times are GMT -5. The time now is 07:07 PM.