pandora-scripts: unhardcode some sysfs paths
[openpandora.oe.git] / recipes / pandora-system / pandora-scripts / op_bright.sh
index dcf223a..709b3af 100755 (executable)
@@ -1,9 +1,12 @@
 #!/bin/bash
-#get value range
+
+. /usr/pandora/scripts/op_paths.sh
+
+# get value range
 minbright=3
-maxbright="$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness)"
-curbright="$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness)"
-device=/sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness
+maxbright="$(cat $SYSFS_BACKLIGHT/max_brightness)"
+curbright="$(cat $SYSFS_BACKLIGHT/brightness)"
+
 if [ ! $1 ]; then
 newbright=$(zenity --scale --text "Set brightness" --min-value=$minbright --max-value=$maxbright --value=$curbright --step 1)
 else
@@ -12,5 +15,5 @@ fi
 if [ $newbright ]; then
         if [ $newbright -le $minbright ]; then newbright=$minbright; fi
         if [ $newbright -ge $maxbright ]; then newbright=$maxbright; fi
-       echo $newbright > $device
+       echo $newbright > $SYSFS_BACKLIGHT_BRIGHTNESS
 fi