From: Grazvydas Ignotas Date: Mon, 14 May 2012 22:33:31 +0000 (+0300) Subject: op_power: don't change brightness under new kernel on blank X-Git-Tag: sz_beta5~13 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=openpandora.oe.git;a=commitdiff_plain;h=afadc0e4570ee55a698f97f832cb3df1c3441407 op_power: don't change brightness under new kernel on blank the kernel handles this now --- diff --git a/recipes/pandora-system/pandora-scripts/op_power.sh b/recipes/pandora-system/pandora-scripts/op_power.sh index e5b5e61..8dc1c21 100644 --- a/recipes/pandora-system/pandora-scripts/op_power.sh +++ b/recipes/pandora-system/pandora-scripts/op_power.sh @@ -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 }