Compile your kernel with ACPI enabled
The default kernel comes with this already enabled. To check if you have ACPI compiled and enabled, see if the directory /proc/acpi/ exists. If not, in your kernal enable the following:
|Linux Kernel Configuration: Enabling ACPI|
Power management options (ACPI, APM) ---> [*] ACPI Support (Advanced Configuration and Power Interface) Support ---> [*] Deprecated /proc/acpi/event support <*> AC Adapter <*> Battery <*> Button <*> Fan < > Dock <*> Processor <*> Thermal Zone
The tools for ACPI are found under sys-power/acpid.
emerge --ask --verbose sys-power/acpid
|Note: As of linux 2.6.23, you will need to manually enable the deprecated /proc/events/acpi option in the kernel. See previous section for kernel configuration.|
You can turn it on using:
To have it start up when you start the machine, add it to the default runlevel:
rc-update add acpid default
If you add any config files while ACPI is running you have to restart it to reload the rules
Following are some configuration file examples for setting up ACPI after it is emerged. Remember to make the scripts executable: chmod +x /etc/acpi/<script-filename>
This is only recommended to use on laptops. It will hibernate the computer if it is not connected to AC power supply. On most PCs the required file /proc/acpi/ac_adapter/AC/state does not exist. There might be also issues with the graphics card on some machines, even on laptops. If you've opened a SSH connection to your computer and called hibernate-ram in it. It will shutdown completely. If you press the power-button, you can proceed in your SSH connection but you don't get anything displayed on your monitor - everything else is working fome (according to lspci, etc.).
The following script requires the package "hibernate-script":
emerge -av hibernate-script rc-update add hibernate-cleanup boot
#!/bin/bash if [ "`sed -e "s/.[^ ]* *//" /proc/acpi/ac_adapter/AC/state`" = "on-line" ] then logger "ACPI: AC adapter is on-line, not hibernating..." else logger "ACPI: AC adapter is off-line, hibernating..." hibernate-ram fi
This will set your computer to the standby-mode. There aren't high power savings. On this machine, I've got a power saving of 20% compared to idle mode. Note: Your LAN connection will possibly break, so that you cannot use SSH during standby-mode. It's better to shutdown the computer to hibernate as it will save more power. You can wake up your computer from standby-mode through pressing the power-button. Again, this script should only be used if you really have a laptop as it relies on ACPI-events that report the battery status which do not exist on PCs.
event=battery.* action=echo -e "\a"
#!/bin/bash logger "ACPI: Time to sleep" touch /tmp/was_sleeping echo -n standby > /sys/power/state
This script will be executed when pressing the power-button of your computer. It should be also working on PCs with ACPI-support. This script implements three power-modes:
- Standby (S1)
- Suspend to disk
The default is standby. Suspend to disk is not working on most of the computers, use standby or shutdown in this case instead. If you want to use shutdown, note that you will not be able to proceed with your session. It will shutdown your computer completely. If you want to proceed with your work, use standby or suspend to disk instead, if available.
#!/bin/bash COMMAND="echo -n standby >| /sys/power/state" #standby #COMMAND="echo -n disk >| /sys/power/state" #suspend to disk #COMMAND="/etc/init.d/shutdown.sh" #shutdown if [ ! -f /tmp/was_sleeping ] then touch /tmp/was_sleeping logger "ACPI: Going to sleep..." exec $COMMAND else rm -f /tmp/was_sleeping logger "ACPI: Was on S1 state, not going to sleep mode" fi
Having saved the scripts to disk, you need to reload the configuration. See the "Run" section how to do so.
- The power management guide will help you reducing the power consumption of your laptop
- HOWTO Automatically turn off your monitor
- Fix common ACPI problems
- Troubleshooting ACPI
- The Scripts Category on the ThinkWiki has some good ACPI scripts.
This page was originally taken from linux.gentoo.user on Google Groups.
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should list their apartments, townhouses and units in Australia.