op_lid.sh: Script will do nothing if Pandora is in powersave mode. Added
authorMichael Mrozek <EvilDragon@openpandora.de>
Thu, 5 Aug 2010 08:37:03 +0000 (10:37 +0200)
committerMichael Mrozek <EvilDragon@openpandora.de>
Thu, 5 Aug 2010 08:37:03 +0000 (10:37 +0200)
LCD off (by urjaman)
op_power.sh: Moved restoring CPU speed to the beginning of the script.
Added LCD off (by urjaman)

testdata/scripts/op_lid.sh
testdata/scripts/op_power.sh

index 0c351bc..67d4ba4 100755 (executable)
@@ -7,7 +7,10 @@ if [ ! -e /tmp/powerstate ]; then #do nothing when in powersave mode
     #/usr/pandora/scripts/op_bright.sh 0
     cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness > /tmp/oldbright
     echo 0 > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
+    echo 1 > /sys/devices/platform/omapfb/graphics/fb0/blank
   elif [ "$1" = "0" ]; then # lid was opend
+    echo 0 > /sys/devices/platform/omapfb/graphics/fb0/blank
+    sleep 0.1s # looks cleaner, could flicker without
     maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness)
     oldbright=$(cat /tmp/oldbright)
      if [ $oldbright -ge 3 ] && [ $oldbright -le $maxbright ]; then 
index 465dad8..4039c1f 100755 (executable)
@@ -10,20 +10,22 @@ if [ "$1" -le "2" ]; then # button was pressed 1-2sec, "suspend"
   fi
   if [ $powerstate -eq "1" ]; then
     #in lowpower mode
+    if [ $oldspeed -gt 14 ] && [ $oldspeed -le 900 ]; then 
+     echo $oldspeed > /proc/pandora/cpu_mhz_max 
+    else
+      echo 500 > /proc/pandora/cpu_mhz_max
+    fi
     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)
+    echo 0 > /sys/devices/platform/omapfb/graphics/fb0/blank
+    sleep 0.1s # looks cleaner, could flicker without
+    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 -gt 14 ] && [ $oldspeed -le 900 ]; then 
-    # echo $oldspeed > /proc/pandora/cpu_mhz_max 
-    #else
-    #  echo 500 > /proc/pandora/cpu_mhz_max
-    #fi
     hcistate=$(cat /tmp/hcistate)
     if [ ! $hcistate ]; then
       hciconfig hci0 up
@@ -38,10 +40,11 @@ if [ "$1" -le "2" ]; then # button was pressed 1-2sec, "suspend"
       kill -18 $PID #send SIGCONT
     done
     echo 255 > /sys/class/leds/pandora\:\:power/brightness #power LED bright
+    rm /tmp/powerstate
   else
     #in normal mode
     echo 1 > /tmp/powerstate
-    #cat /proc/pandora/cpu_mhz_max > /tmp/oldspeed
+    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
@@ -63,8 +66,9 @@ if [ "$1" -le "2" ]; then # button was pressed 1-2sec, "suspend"
            /etc/init.d/wl1251-init stop
     fi
     echo 0 > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
+    echo 1 > /sys/devices/platform/omapfb/graphics/fb0/blank
     echo 16 > /sys/class/leds/pandora\:\:power/brightness #dim power LED
-    #echo 14 > /proc/pandora/cpu_mhz_max
+    echo 14 > /proc/pandora/cpu_mhz_max
   fi
 elif [ "$1" -ge "3" ]; then #button was pressed 3 sec or longer, shutdown
   xfceuser=$(ps u -C xfce4-session | tail -n1 | awk '{print $1}')