Power management

From The World according to Vissie
Jump to navigation Jump to search

Power management

To get power management working you have to disable apm & enable acpi (all of it :)) if you include it as modules make sure they are loading on startup. My present power management setup is using speedfeq and cpusynd, the following is a brilliant resource: http://www.stud.uni-karlsruhe.de/~uxhz/gentoo/power-management/ I recommend following the instructions to create a battery runlevel and using the default.sh to handle acpi events. I added a simple handler for the power button press which was astoundingly easy:

vim: /etc/acpi/events/powerbtn
event=button[ /]power
action=/etc/acpi/powerbtn.sh


vim: /etc/acpi/powerbtn.sh
#!/bin/sh
logger "ACPI - Power Button pressed - going down now!"
/sbin/poweroff

->Don't forget to chmod powerbtn.sh

To control the backlight & vga out you need to install radeontool:

emerge radeontool

I added another acpi event handler for the lid close action to power off the backlight

vim: /etc/acpi/events/lid
event=button[ /]lid
action=/etc/acpi/lid.sh


vim: /etc/acpi/lid.sh
#!/bin/sh
lidnum=`echo $1 | sed 's/.*\(LID[^ ]*\).*/\1/'`
grep open /proc/acpi/button/lid/$lidnum/state > /dev/null
if [ $? -eq 0 ]; then
	/usr/bin/radeontool light on
else
	/usr/bin/radeontool light off
fi

->Don't forget to chmod it!

I also added a tiny script to dim the backlight to 0 when on battery & set it to full on AC in:


vim: /etc/init.d/setbright
#!/sbin/runscript
start() {
    /usr/bin/spicctrl -b 0
}
stop() {
   /usr/bin/spicctrl -b 255
}

->Don't forget to chmod it & add it to the battery runlevel


For SSD drives, please look at : http://www.informit.com/articles/article.aspx?p=1565700 Setting Up Hibernation on Linux SSD Netbooks Without Swap, Part 1