X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-libraries.git;a=blobdiff_plain;f=testdata%2Fscripts%2Fop_lid.sh;h=88e208787c70ff4ea1231baf80d38c392943501a;hp=1ec445d8b4ba2affedd19da1dc7c418bbd3d58e6;hb=59057ad73b927af0c6d816bd33caa13f5eaabff2;hpb=000de7c3e6b28dc7dbe040dd5d931bd8f7e80ee6 diff --git a/testdata/scripts/op_lid.sh b/testdata/scripts/op_lid.sh index 1ec445d..88e2087 100755 --- a/testdata/scripts/op_lid.sh +++ b/testdata/scripts/op_lid.sh @@ -3,8 +3,16 @@ #only argument is 0 for open 1 for closed if [ "$1" = "1" ]; then #lid was closed - /usr/pandora/scripts/op_bright.sh 0 + #/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 elif [ "$1" = "0" ]; then # lid was opend - /usr/pandora/scripts/op_bright.sh $(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness) + maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness) + oldbright=$(cat /tmp/oldbright) + if [ $oldbright -ge 0 ] && [ $oldbright -le $maxbright ]; then + /usr/pandora/scripts/op_bright.sh $oldbright + else + /usr/pandora/scripts/op_bright.sh $maxbright + fi fi