pandora-scripts: Update helper scripts.
[openpandora.oe.git] / recipes / pandora-system / pandora-scripts / op_bright.sh
1 #!/bin/bash
2 #get value range
3 minbright=3
4 maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness)
5 curbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness)
6 device=/sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
7 if [ ! $1 ]; then
8 newbright=$(DISPLAY=0:0 zenity --scale --text "set brightness" --min-value=$minbright --max-value=$maxbright --value=$curbright --step 1)
9 else
10 newbright=$1
11 fi
12 if [ $newbright ]; then
13         if [ $newbright -le $minbright ]; then newbright=$minbright; fi
14         if [ $newbright -ge $maxbright ]; then newbright=$maxbright; fi
15 fi
16 echo $newbright > $device