summaryrefslogtreecommitdiff
path: root/recipes/display-brightness
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/display-brightness
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
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}/
+}