TIP ACPI basic configuration
From Gentoo Linux Wiki
| Terminals / Shells • Network • X Window System • Portage • System • Filesystems • Kernel • Other |
- Originally taken from linux.gentoo.user on Google Groups
ACPI (Advanced Configuration and Power Interface) is an interface for OS-directed configuration and power management. Devices such as AC adapters, Battery management, Thermal Controllers, Fans, and Lid Switches, as well as the usual Power On/Off and Sleep buttons are a few examples of such.
Contents |
[edit] Install
The tools for ACPI are found under sys-power/acpid.
emerge --ask --verbose sys-power/acpid
As of linux 2.6.23, you will need to manually enable the deprecated /proc/events/acpi option.
[edit] Run
You can turn it on using:
/etc/init.d/acpid start
To turn acpid on 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
/etc/init.d/acpid restart
[edit] Configuration
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>
[edit] Lid
| File: /etc/acpi/events/lid |
event=button/lid.* action=/etc/acpi/lid.sh |
| File: /etc/acpi/lid.sh |
#!/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
|
[edit] Sleep
| File: /etc/acpi/events/sleep |
event=button/sleep.* action=/etc/acpi/sleep.sh |
| File: /etc/acpi/events/battery |
event=battery.* action=echo -e "\a" |
| File: /etc/acpi/sleep.sh |
#!/bin/bash logger "ACPI: Time to sleep" touch /tmp/was_sleeping echo -n standby > /sys/power/state |
[edit] Power
| File: /etc/acpi/events/power |
event=button/power.* action=/etc/acpi/power.sh |
| File: /etc/acpi/power.sh |
#!/bin/bash
if [ ! -f /tmp/was_sleeping ]
then
touch /tmp/was_sleeping
echo -n standby >| /sys/power/state # S1
# echo -n disk >| /sys/power/state # Suspend 2 Disk
# /etc/init.d/shutdown.sh
else
rm -f /tmp/was_sleeping
logger "ACPI: Was on S1 State. I'm not going to sleep mode"
fi
|
[edit] Links
- HOWTO Automatically turn off your monitor
- HOWTO Fix Common ACPI Problems
- Troubleshooting ACPI
- HOWTO Software Suspend v2
- The Scripts Category on the ThinkWiki has some good ACPI scripts.
This article is still a Stub. You can help Gentoo-Wiki by expanding it.
