LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Changing ACPI cpufreq when running on battery (https://www.linuxquestions.org/questions/slackware-14/changing-acpi-cpufreq-when-running-on-battery-391686/)

Yalla-One 12-11-2005 06:53 PM

Changing ACPI cpufreq when running on battery
 
Is there any way to get Slackware to automagically run a script that changes the scaling_governor from ondemand or performance to powersave once the system runs on batteries, and then back to ondemand or performance when it's plugged in again?

I'm currently running echo -n ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor on boot, but I haven't found any hooks anywhere under ACPI to run a similar (except powersave) when the system is unplugged..

Anyone?

-Y1

Namaseit 12-11-2005 07:05 PM

Well if I am not mistaken you can see if the laptop is plugged in or not in /proc/acpi. Write a script to just parse the right file every what, 1 minute, maybe 30 seconds. Then if it shows it's not plugged in it changes the schema. Simple enough.

Yalla-One 12-11-2005 07:14 PM

That's one way of doing it, but being a purist I'm not a big fan of scripts that poll a file every n seconds, so what I was hoping for is that there's a hook somewhere that runs a script when I unplug power.
There is a directory called /etc/acpi that contains some default actions and a handler-script, but all documentation I've found so far relate to putting the system into hibernate/sleep, and not just changing runlevel when unpowering the system.

-Y1

Namaseit 12-11-2005 08:28 PM

Not sure what the 'purist' reference is, but to me whatever works is best. To each his own I suppose. Scripts are just an easy way to do tasks. You can do that in >30 lines of bash scripting, but eh.

cathectic 12-12-2005 08:15 AM

You could use something like cpufreqd to automatically change the governor when on batteries (laptop-mode-tools also has some basic support for changing cpu frequency governor).


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