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 brightness=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness)
8 if [ $brightness -gt 0 ]; then
9 echo $brightness > /tmp/oldbright
11 echo 0 > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
12 echo 1 > /sys/devices/platform/omapfb/graphics/fb0/blank
13 elif [ "$1" = "0" ]; then # lid was opend
14 echo 0 > /sys/devices/platform/omapfb/graphics/fb0/blank
15 sleep 0.1s # looks cleaner, could flicker without
16 maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness)
17 oldbright=$(cat /tmp/oldbright)
18 if [ $oldbright -ge 3 ] && [ $oldbright -le $maxbright ]; then
19 /usr/pandora/scripts/op_bright.sh $oldbright
21 /usr/pandora/scripts/op_bright.sh $maxbright