op_power: reload modules correctly
[openpandora.oe.git] / recipes / pandora-system / pandora-scripts / op_bright.sh
1 #!/bin/bash
2
3 . /usr/pandora/scripts/op_paths.sh
4
5 # get value range
6 minbright=3
7 maxbright="$(cat $SYSFS_BACKLIGHT/max_brightness)"
8 curbright="$(cat $SYSFS_BACKLIGHT/brightness)"
9
10 if [ ! $1 ]; then
11 newbright=$(zenity --scale --text "Set brightness" --min-value=$minbright --max-value=$maxbright --value=$curbright --step 1)
12 else
13 newbright=$1
14 fi
15 if [ $newbright ]; then
16         if [ $newbright -le $minbright ]; then newbright=$minbright; fi
17         if [ $newbright -ge $maxbright ]; then newbright=$maxbright; fi
18         echo $newbright > $SYSFS_BACKLIGHT_BRIGHTNESS
19 fi