wok-current view acpid/stuff/acpi/button.sh @ rev 6265
Up: gutenprint, gutenprint-dev to 5.2.6.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Tue Sep 14 14:42:29 2010 +0000 (2010-09-14) |
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