2 #actions done when the lid is closed
3 #only argument is 0 for open 1 for closed
5 if [ -e /tmp/powerstate ]; then #do nothing when in powersave mode
6 if [ "$1" = "1" ]; then #lid was closed
7 #/usr/pandora/scripts/op_bright.sh 0
8 cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness > /tmp/oldbright
9 echo 0 > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
10 elif [ "$1" = "0" ]; then # lid was opend
11 maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness)
12 oldbright=$(cat /tmp/oldbright)
13 if [ $oldbright -ge 3 ] && [ $oldbright -le $maxbright ]; then
14 /usr/pandora/scripts/op_bright.sh $oldbright
16 /usr/pandora/scripts/op_bright.sh $maxbright