wok-6.x view acpid/stuff/acpi/button.sh @ rev 1624

acpid: add power savings scripts
author Dominique Corbex <domcox@users.sourceforge.net>
date Thu Oct 23 20:07:24 2008 +0000 (2008-10-23)
parents
children
line source
1 #!/bin/sh
2 # button.sh - Managing button events for SliTaz
3 #
5 source /etc/acpi/key-constants
7 # logger "button.sh: event=$1"
9 # take care about the way events are reported
11 EVENT_TYPE=`echo $1 | cut -d/ -f1`
12 if [ $EVENT_TYPE = $1 ]; then
13 EVENT=$2
14 else
15 EVENT=`echo "$1" | cut -d/ -f2`
16 fi
18 case $EVENT in
19 power)
20 logger "Event: button/power - sending KEY_EXIT($KEY_EXIT)"
21 /usr/bin/acpi_fakekey $KEY_EXIT
22 ;;
23 lid)
24 if [ -e /usr/bin/suspend ] ; then
25 logger "Event: button/lid - suspending"
26 /usr/bin/suspend
27 else
28 logger "Event: button/lid - /usr/bin/suspend not found, skipping.."
29 fi
30 ;;
31 sleep)
32 if [ -e /usr/bin/hibernate ] ; then
33 logger "Event: button/sleep - hibernating"
34 /usr/bin/hibernate
35 else
36 logger "Event: button/sleep - /usr/bin/hibernate not found, skipping.."
37 fi
38 ;;
39 esac