this way op_lid can be called multiple times with same argument.
if [ ! -e /tmp/powerstate ]; then #do nothing when in powersave mode
if [ "$1" = "1" ]; then #lid was closed
- #/usr/pandora/scripts/op_bright.sh 0
- cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness > /tmp/oldbright
+ brightness=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness)
+ if [ $brightness -gt 0 ]; then
+ echo $brightness > /tmp/oldbright
+ fi
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