wok diff acpid/stuff/acpi/button.sh @ rev 9171

tcc: fix compile_rules
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Mar 08 17:23:59 2011 +0100 (2011-03-08)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/acpid/stuff/acpi/button.sh	Tue Mar 08 17:23:59 2011 +0100
     1.3 @@ -0,0 +1,39 @@
     1.4 +#!/bin/sh
     1.5 +# button.sh - Managing button events for SliTaz
     1.6 +# 
     1.7 +
     1.8 +source /etc/acpi/key-constants
     1.9 +
    1.10 +# logger "button.sh: event=$1"
    1.11 +
    1.12 +# take care about the way events are reported
    1.13 +
    1.14 +EVENT_TYPE=`echo $1 | cut -d/ -f1`
    1.15 +if [ $EVENT_TYPE = $1 ]; then
    1.16 +	EVENT=$2
    1.17 +else
    1.18 +	EVENT=`echo "$1" | cut -d/ -f2`
    1.19 +fi
    1.20 +
    1.21 +case $EVENT in
    1.22 +	power)
    1.23 +		logger "Event: button/power - sending KEY_EXIT($KEY_EXIT)"
    1.24 +		/usr/bin/acpi_fakekey $KEY_EXIT
    1.25 +	;;
    1.26 +	lid)
    1.27 +		if [ -e /usr/bin/suspend ] ; then
    1.28 +			logger "Event: button/lid - suspending"
    1.29 +			/usr/bin/suspend
    1.30 +		else
    1.31 +			logger "Event: button/lid - /usr/bin/suspend not found, skipping.."
    1.32 +		fi
    1.33 +	;;
    1.34 +	sleep)
    1.35 +		if [ -e /usr/bin/hibernate ] ; then
    1.36 +			logger "Event: button/sleep - hibernating"
    1.37 +			/usr/bin/hibernate
    1.38 +		else
    1.39 +			logger "Event: button/sleep - /usr/bin/hibernate not found, skipping.."
    1.40 +		fi
    1.41 +	;;
    1.42 +esac