2 #actions done when the power button is pressed
3 #only argument is the time the button was pressed in seconds
5 if [ "$1" -le "3" ]; then # button was pressed 1-3sec, "suspend"
6 if [ -e /tmp/powerstate ]; then
7 powerstate=$(cat /tmp/powerstate)
11 if [$powerstate -eq 1 ]; then
13 echo 0 > /tmp/powerstate
14 oldbright=$(cat /tmp/oldbright)
15 maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness)
16 oldspeed=$(cat /tmp/oldspeed)
17 if [ $oldbright -ge 3 ] && [ $oldbright -le $maxbright ]; then
18 /usr/pandora/scripts/op_bright.sh $oldbright
20 /usr/pandora/scripts/op_bright.sh $maxbright
22 if [ $oldspeed -ge 14 ] && [ $oldspeed -le 1000 ]; then
23 echo $oldspeed > /proc/pandora/cpu_mhz_max
25 echo 500 > /proc/pandora/cpu_mhz_max
28 /etc/init.d/S30wlxxx-i/etc/init.d/wl1251-init start
29 pidlist=$(pstree -lpA | grep pnd_run.sh | sed -ne 's/.*(\([0-9]\+\))/\1/p')
32 kill -18 $PID #send SIGCONT
36 echo 1 > /tmp/powerstate
37 cat /proc/pandora/cpu_mhz_max > /tmp/oldspeed
38 cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness > /tmp/oldbright
39 pidlist=$(pstree -lpA | grep pnd_run.sh | sed -ne 's/.*(\([0-9]\+\))/\1/p')
42 kill -19 $PID #send SIGSTOP
45 /etc/init.d/S30wlxxx-i/etc/init.d/wl1251-init stop
46 echo 0 > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
47 echo 14 > /proc/pandora/cpu_mhz_max
49 elif [ "$1" -ge "4" ]; then #button was pressed 4 sec or longer, shutdown