op_power: don't change brightness under new kernel on blank
authorGrazvydas Ignotas <notasas@gmail.com>
Mon, 14 May 2012 22:33:31 +0000 (01:33 +0300)
committerGrazvydas Ignotas <notasas@gmail.com>
Mon, 14 May 2012 22:33:31 +0000 (01:33 +0300)
the kernel handles this now

recipes/pandora-system/pandora-scripts/op_power.sh

index e5b5e61..8dc1c21 100644 (file)
@@ -56,6 +56,13 @@ resume_net() {
 display_on() {
        echo 0 > /sys/class/graphics/fb0/blank
 
+       # only bother restoring brightness if it's 0
+       # (old kernel or user messed it up somehow)
+       brightness=$(cat $SYSFS_BACKLIGHT_BRIGHTNESS)
+       if [ $brightness -gt 0 ]; then
+               return 0
+       fi
+
        maxbright=$(cat $SYSFS_BACKLIGHT/max_brightness)
        oldbright=0
        if [ -f /tmp/oldbright ]; then
@@ -76,7 +83,10 @@ display_off() {
        if [ $brightness -gt 0 ]; then
                echo $brightness > /tmp/oldbright
        fi
-       echo 0 > $SYSFS_BACKLIGHT_BRIGHTNESS
+       kernel_major=`uname -r | cut -c 1`
+       if [ "$kernel_major" = "2" ]; then
+               echo 0 > $SYSFS_BACKLIGHT_BRIGHTNESS
+       fi
 
        echo 1 > /sys/class/graphics/fb0/blank
 }