2 #actions done when the lid is closed
3 #only argument is 0 for open 1 for closed
4 #may also be called after inactivity, like X DPMS
6 if [ ! -e /tmp/powerstate ]; then #do nothing when in powersave mode
7 if [ "$1" = "1" ]; then #lid was closed
8 brightness=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness)
9 if [ $brightness -gt 0 ]; then
10 echo $brightness > /tmp/oldbright
12 echo 0 > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
13 #echo 1 > /sys/devices/platform/omapfb/graphics/fb0/blank
14 elif [ "$1" = "0" ]; then # lid was opened
15 #echo 0 > /sys/devices/platform/omapfb/graphics/fb0/blank
16 #sleep 0.1s # looks cleaner, could flicker without
17 maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness)
19 if [ -f /tmp/oldbright ]; then
20 oldbright=$(cat /tmp/oldbright)
22 if [ $oldbright -eq 0 ]; then
23 oldbright=$(cat /etc/pandora/conf/brightness.state)
25 if [ $oldbright -ge 3 ] && [ $oldbright -le $maxbright ]; then
26 /usr/pandora/scripts/op_bright.sh $oldbright
28 /usr/pandora/scripts/op_bright.sh $maxbright