Author: havner Date: Sat Jul 22 17:33:34 2006 GMT Module: SOURCES Tag: HEAD ---- Log message: - new default configuration files - examples for power/sleep/lid(open/close) included as well as for ac plug/unplug
---- Files affected: SOURCES: acpid.battery.conf (NONE -> 1.1) (NEW), acpid.battery.sh (NONE -> 1.1) (NEW), acpid.button.conf (NONE -> 1.1) (NEW), acpid.button.sh (NONE -> 1.1) (NEW) ---- Diffs: ================================================================ Index: SOURCES/acpid.battery.conf diff -u /dev/null SOURCES/acpid.battery.conf:1.1 --- /dev/null Sat Jul 22 19:33:34 2006 +++ SOURCES/acpid.battery.conf Sat Jul 22 19:33:29 2006 @@ -0,0 +1,6 @@ +# /etc/acpid/events/battery +# This detects changes to AC connector status, and passes them to +# /etc/acpi/actions/battery.sh for further processing. + +event=battery +action=/etc/acpi/actions/battery.sh "%e" ================================================================ Index: SOURCES/acpid.battery.sh diff -u /dev/null SOURCES/acpid.battery.sh:1.1 --- /dev/null Sat Jul 22 19:33:34 2006 +++ SOURCES/acpid.battery.sh Sat Jul 22 19:33:29 2006 @@ -0,0 +1,39 @@ +#!/bin/sh +# /etc/acpid/actions/battery.sh +# based on work by Frank Dietrich <[EMAIL PROTECTED]> +# +# Detect AC connector plugged in or unplugged and take appropriate actions. + +if [ $# != 1 ]; then + exit 1 +fi +set $* + +# get the AC connector state from /proc filesystem. +STATE=`sed -n 's/^.*\(off\|on\)-line.*/\1/p' /proc/acpi/ac_adapter/AC/state` + +case "$STATE" in + on) + # AC connector plugged in + logger "acpid: AC connector plugged in." + # deactivate standby (spindown) timeout for the drive + #hdparm -q -S 0 /dev/hda + # handle proccessor + #echo 0 > /proc/acpi/processor/CPU0/throttling + #echo 0 > /proc/acpi/processor/CPU0/performance + ;; + off) + # AC connector unplugged + logger "acpid: AC connector unplugged." + # activate standby (spindown) timeout for the drive + # timeout 5 minutes (man hdparm, for more informations) + #hdparm -q -S 60 /dev/hda + # handle processor + #echo 4 > /proc/acpi/processor/CPU0/throttling + #echo 3 > /proc/acpi/processor/CPU0/performance + ;; + *) + # AC connector in undetermined state + logger "acpid: Could not determine new AC connector state." + ;; +esac ================================================================ Index: SOURCES/acpid.button.conf diff -u /dev/null SOURCES/acpid.button.conf:1.1 --- /dev/null Sat Jul 22 19:33:34 2006 +++ SOURCES/acpid.button.conf Sat Jul 22 19:33:29 2006 @@ -0,0 +1,9 @@ +# /etc/acpid/events/button +# This detects buttons pressed, and passes them to +# /etc/acpi/actions/button.sh for further processing. + +event=button +action=/etc/acpi/actions/button.sh "%e" + +#for 2.4 kernels +#action=/etc/acpi/actions/power.sh "`echo "%e" | sed "s#button\ #button/#"`" ================================================================ Index: SOURCES/acpid.button.sh diff -u /dev/null SOURCES/acpid.button.sh:1.1 --- /dev/null Sat Jul 22 19:33:34 2006 +++ SOURCES/acpid.button.sh Sat Jul 22 19:33:29 2006 @@ -0,0 +1,44 @@ +#!/bin/sh +# /etc/acpid/actions/button.sh +# +# Detect buttons pressed and take appropriate actions. + +if [ $# != 1 ]; then + exit 1 +fi +set $* + +case "$1" in + button/power) + logger "acpid: $1 action is not defined." + # halt computer + #halt + # put computer to sleep (not all machines have sleep button) + #echo mem > /sys/power/state + #hibernate + ;; + button/sleep) + logger "acpid: $1 action is not defined" + # put computer to sleep + #echo mem > /sys/power/state + #hibernate + ;; + button/lid) + logger "acpid: $1 action is not defined" + # put computer to sleep + #echo mem > /sys/power/state + + # if you want to specify separate commands for lid open/close uncomment this section: + + #NUMBER=`printf "%d" "0x$4"` + #EVEN=`dc -e "1 k $NUMBER 2 / p" | grep "\.0"` + #if [ ! "$EVEN" ]; then + # logger "acpid: lid close action is not defined" + #else + # logger "acpid: lid open action is not defined" + #fi + ;; + *) + logger "acpid: $1 action is not defined" + ;; +esac ================================================================ _______________________________________________ pld-cvs-commit mailing list [email protected] http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit
