summaryrefslogtreecommitdiff
path: root/recipes/display-brightness
diff options
context:
space:
mode:
Diffstat (limited to 'recipes/display-brightness')
-rw-r--r--recipes/display-brightness/display-brightness.sh54
-rw-r--r--recipes/display-brightness/display-brightness_1.0.0.bb13
2 files changed, 67 insertions, 0 deletions
diff --git a/recipes/display-brightness/display-brightness.sh b/recipes/display-brightness/display-brightness.sh
new file mode 100644
index 0000000000..935dabff7b
--- /dev/null
+++ b/recipes/display-brightness/display-brightness.sh
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+# display-brightness.sh
+# simple script to set display-brightness for zaurus clamshell
+# author: patrick steiner <patrick.steiner@a1.net>
+# version: 1.00 | 22.02.2005 23:20
+
+
+STEP=5
+DRIVER="`ls /sys/class/backlight/|head -n 1`"
+MAX_BRIGHTNESS=`cat /sys/class/backlight/$DRIVER/max_brightness`
+ACTUAL_BRIGHTNESS=`cat /sys/class/backlight/$DRIVER/actual_brightness`
+BRIGHTNESS_FILE="/sys/class/backlight/$DRIVER/brightness"
+
+if test "$1" != "up" -a "$1" != "down" -a -n "$1"
+then
+ echo -e "\nUsage:\n\t `basename $0` [up | down]\n"
+ exit 0
+fi
+
+echo "max / current"
+echo "$MAX_BRIGHTNESS / $ACTUAL_BRIGHTNESS"
+if [ ! -n "$1" ]; then
+ exit 0
+fi
+
+if [ "$1" = "up" ]; then
+ if [ $ACTUAL_BRIGHTNESS -eq $MAX_BRIGHTNESS ]; then
+ exit 0
+ else
+
+ test -x /usr/bin/bl && bl on
+ test "$STEP" -gt "$MAX_BRIGHTNESS" -o "$STEP" -eq "$MAX_BRIGHTNESS" && STEP=1
+ let CURRENT_BRIGHTNESS=$ACTUAL_BRIGHTNESS+$STEP
+ echo $CURRENT_BRIGHTNESS >> $BRIGHTNESS_FILE
+ exit 0
+ fi
+fi
+
+if [ "$1" = "down" ]; then
+ if [ $ACTUAL_BRIGHTNESS -lt 2 ]; then
+ exit 0
+ elif [ $ACTUAL_BRIGHTNESS -lt $STEP ]; then
+ STEP=1
+ let CURRENT_BRIGHTNESS=$ACTUAL_BRIGHTNESS-$STEP
+ echo $CURRENT_BRIGHTNESS >> $BRIGHTNESS_FILE
+ exit 0
+ else
+ let CURRENT_BRIGHTNESS=$ACTUAL_BRIGHTNESS-$STEP
+ echo $CURRENT_BRIGHTNESS >> $BRIGHTNESS_FILE
+ exit 0
+ fi
+fi
+
diff --git a/recipes/display-brightness/display-brightness_1.0.0.bb b/recipes/display-brightness/display-brightness_1.0.0.bb
new file mode 100644
index 0000000000..f06fde0fa9
--- /dev/null
+++ b/recipes/display-brightness/display-brightness_1.0.0.bb
@@ -0,0 +1,13 @@
+DESCRIPTION = "display brightness utility"
+AUTHOR = "Patrick Steiner <patrick.steiner@a1.net>"
+DEPENDS = ""
+PRIORITY = "optional"
+PR = "r4"
+LICENSE = "GPLv2"
+
+SRC_URI = "file://display-brightness.sh"
+
+do_install() {
+ install -d ${D}${bindir}
+ install -m 0755 ${WORKDIR}/display-brightness.sh ${D}${bindir}/
+}