From 59057ad73b927af0c6d816bd33caa13f5eaabff2 Mon Sep 17 00:00:00 2001 From: vimacs Date: Wed, 17 Feb 2010 13:14:54 +0100 Subject: [PATCH] Remember old brightnes, dont use op_bright.sh modified: testdata/scripts/op_lid.sh --- testdata/scripts/op_lid.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 -- 2.39.5