From bc4d4dc38a023300e18c1aa3ee94b6d74c5df445 Mon Sep 17 00:00:00 2001 From: vimacs Date: Thu, 18 Feb 2010 15:52:28 +0100 Subject: [PATCH] new standby script modified: testdata/scripts/op_power.sh --- testdata/scripts/op_power.sh | 56 +++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 17 deletions(-) diff --git a/testdata/scripts/op_power.sh b/testdata/scripts/op_power.sh index cdbbaf4..d6d4fa5 100755 --- a/testdata/scripts/op_power.sh +++ b/testdata/scripts/op_power.sh @@ -2,23 +2,45 @@ #actions done when the power button is pressed #only argument is the time the button was pressed in seconds -if [ "$1" -le "1" ]; then #button was pressed 1 sec or less, resume - pidlist=$(pstree -lpA | grep pnd_run.sh | sed -ne 's/.*(\([0-9]\+\))/\1/p') - for PID in $pidlist - do - kill -18 $PID #send SIGCONT - done - /usr/pandora/scripts/op_cpuspeed.sh 500 - /usr/pandora/scripts/op_bright.sh $(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness) -elif [ "$1" -le "3" ]; then # button was pressed 1-3sec, "suspend" - pidlist=$(pstree -lpA | grep pnd_run.sh | sed -ne 's/.*(\([0-9]\+\))/\1/p') - for PID in $pidlist - do - kill -19 $PID #send SIGSTOP - done - /usr/pandora/scripts/op_bright.sh 0 - /usr/pandora/scripts/op_cpuspeed.sh 14 -elif [ "$1" -ge "3" ]; then #button was pressed 3 sec or longer, shutdown +if [ "$1" -le "3" ]; then # button was pressed 1-3sec, "suspend" + powerstate=$(cat /tmp/powerstate) + if [$powerstate -eq "1" ]; then + #in lowpower mode + echo 0 > /tmp/powerstate + oldbright=$(cat /tmp/oldbright) + maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness) + oldspeed=$(cat /tmp/oldspeed) + if [ $oldbright -ge 3 ] && [ $oldbright -le $maxbright ]; then + /usr/pandora/scripts/op_bright.sh $oldbright + else + /usr/pandora/scripts/op_bright.sh $maxbright + fi + if [ $oldspeed -ge 14 ] && [ $oldspeed -le 1000 ]; then + echo $oldspeed > /proc/pandora/cpu_mhz_max + else + echo 500 > /proc/pandora/cpu_mhz_max + fi + pidlist=$(pstree -lpA | grep pnd_run.sh | sed -ne 's/.*(\([0-9]\+\))/\1/p') + for PID in $pidlist + do + kill -18 $PID #send SIGCONT + done + else + #in normal mode + echo 1 > /tmp/powerstate + cat /proc/pandora/cpu_mhz_max > /tmp/oldspeed + cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness > /tmp/oldbright + pidlist=$(pstree -lpA | grep pnd_run.sh | sed -ne 's/.*(\([0-9]\+\))/\1/p') + for PID in $pidlist + do + kill -19 $PID #send SIGSTOP + done + hciconfig hci0 down + /etc/init.d/S30wlxxx-init stop + echo 0 > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness + echo 14 > /proc/pandora/cpu_mhz_max + fi +elif [ "$1" -ge "4" ]; then #button was pressed 4 sec or longer, shutdown shutdown -h now fi -- 2.39.5