2011-05-18 08:03:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Default acpi script that takes an entry for all actions
|
|
|
|
|
|
|
|
# NOTE: This is a 2.6-centric script. If you use 2.4.x, you'll have to
|
|
|
|
# modify it to not use /sys
|
|
|
|
|
|
|
|
minspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_min_freq`
|
|
|
|
maxspeed=`cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq`
|
|
|
|
setspeed="/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed"
|
|
|
|
|
|
|
|
set $*
|
|
|
|
|
2015-09-09 07:09:55 +00:00
|
|
|
PID=$(pgrep dbus-launch)
|
2016-01-04 00:38:10 +00:00
|
|
|
export USER=$(ps -o user --no-headers $PID)
|
2015-09-09 07:09:55 +00:00
|
|
|
USERHOME=$(getent passwd $USER | cut -d: -f6)
|
|
|
|
export XAUTHORITY="$USERHOME/.Xauthority"
|
|
|
|
for x in /tmp/.X11-unix/*; do
|
|
|
|
displaynum=`echo $x | sed s#/tmp/.X11-unix/X##`
|
|
|
|
if [ x"$XAUTHORITY" != x"" ]; then
|
|
|
|
export DISPLAY=":$displaynum"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2011-05-18 08:03:14 +00:00
|
|
|
case "$1" in
|
|
|
|
button/power)
|
|
|
|
#echo "PowerButton pressed!">/dev/tty5
|
|
|
|
case "$2" in
|
2014-12-05 10:33:53 +00:00
|
|
|
PBTN|PWRF)
|
2014-12-05 11:15:42 +00:00
|
|
|
logger "PowerButton pressed: $2, shutting down..."
|
2014-12-05 10:59:07 +00:00
|
|
|
shutdown -P now
|
2014-12-05 10:33:53 +00:00
|
|
|
;;
|
2011-05-18 08:03:14 +00:00
|
|
|
*) logger "ACPI action undefined: $2" ;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
button/sleep)
|
|
|
|
case "$2" in
|
2014-12-05 10:33:53 +00:00
|
|
|
SBTN|SLPB)
|
2014-12-05 11:15:42 +00:00
|
|
|
# suspend-to-ram
|
|
|
|
logger "Sleep Button pressed: $2, suspending..."
|
|
|
|
zzz
|
2014-12-05 10:33:53 +00:00
|
|
|
;;
|
2011-05-18 08:03:14 +00:00
|
|
|
*) logger "ACPI action undefined: $2" ;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
ac_adapter)
|
|
|
|
case "$2" in
|
|
|
|
AC|ACAD|ADP0)
|
|
|
|
case "$4" in
|
|
|
|
00000000)
|
|
|
|
echo -n $minspeed >$setspeed
|
|
|
|
#/etc/laptop-mode/laptop-mode start
|
|
|
|
;;
|
|
|
|
00000001)
|
|
|
|
echo -n $maxspeed >$setspeed
|
|
|
|
#/etc/laptop-mode/laptop-mode stop
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
*) logger "ACPI action undefined: $2" ;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
battery)
|
|
|
|
case "$2" in
|
|
|
|
BAT0)
|
|
|
|
case "$4" in
|
|
|
|
00000000) #echo "offline" >/dev/tty5
|
|
|
|
;;
|
|
|
|
00000001) #echo "online" >/dev/tty5
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
2015-09-09 07:09:55 +00:00
|
|
|
CPU0)
|
2011-05-18 08:03:14 +00:00
|
|
|
;;
|
|
|
|
*) logger "ACPI action undefined: $2" ;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
button/lid)
|
2014-12-05 10:33:53 +00:00
|
|
|
case "$3" in
|
2014-12-05 11:15:42 +00:00
|
|
|
close)
|
|
|
|
# suspend-to-ram
|
|
|
|
logger "LID closed, suspending..."
|
|
|
|
zzz
|
|
|
|
;;
|
|
|
|
open) logger "LID opened" ;;
|
2014-12-05 10:33:53 +00:00
|
|
|
*) logger "ACPI action undefined (LID): $2";;
|
|
|
|
esac
|
2014-12-05 10:59:07 +00:00
|
|
|
;;
|
2011-05-18 08:03:14 +00:00
|
|
|
*)
|
|
|
|
logger "ACPI group/action undefined: $1 / $2"
|
|
|
|
;;
|
|
|
|
esac
|