dcf223a39d4673aa532a617fa6bbb5b8acd70b91
[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=$(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         echo $newbright > $device
16 fi