pandora-scripts: Add recipe to mop up small system support scripts that are handy...
authorDavid-John Willis <John.Willis@Distant-earth.com>
Wed, 11 Nov 2009 14:36:29 +0000 (14:36 +0000)
committerDavid-John Willis <John.Willis@Distant-earth.com>
Wed, 11 Nov 2009 14:36:29 +0000 (14:36 +0000)
recipes/pandora-system/pandora-scripts.bb [new file with mode: 0644]
recipes/pandora-system/pandora-scripts/pnd_bright.desktop [new file with mode: 0644]
recipes/pandora-system/pandora-scripts/pnd_bright.sh [new file with mode: 0644]

diff --git a/recipes/pandora-system/pandora-scripts.bb b/recipes/pandora-system/pandora-scripts.bb
new file mode 100644 (file)
index 0000000..9522afb
--- /dev/null
@@ -0,0 +1,21 @@
+DESCRIPTION = "Scripts to support system options on the OpenPandora."
+LICENSE = "GPLV2"
+RDEPENDS = "zenity dbus"
+
+COMPATIBLE_MACHINE = "omap3-pandora"
+
+PR = "r0"
+
+SRC_URI = " \
+          file://pnd_bright.sh \
+          file://pnd_bright.desktop \
+"
+
+do_install() {
+          install -d ${D}${prefix}/pandora/scripts/
+          install -m 0755 ${S}/pnd_bright.sh ${D}${prefix}/pandora/scripts/
+          install -d ${D}${datadir}/applications/
+          install -m 0644 ${S}/pnd_bright.desktop ${D}${datadir}/applications/
+}
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
diff --git a/recipes/pandora-system/pandora-scripts/pnd_bright.desktop b/recipes/pandora-system/pandora-scripts/pnd_bright.desktop
new file mode 100644 (file)
index 0000000..0b03d4b
--- /dev/null
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Set Backlight Brightness
+Comment=Set the brightness of the backlight.
+StartupNotify=false
+Exec=/usr/pandora/scripts/pnd_bright.sh
+Icon=Terminal
+Terminal=false
+Type=Application
+Categories=System;
diff --git a/recipes/pandora-system/pandora-scripts/pnd_bright.sh b/recipes/pandora-system/pandora-scripts/pnd_bright.sh
new file mode 100644 (file)
index 0000000..fbfa6f0
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/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
+if [ ! $1 ]; then
+newbright=$(DISPLAY=0:0 zenity --scale --text "set brightness" --min-value=$minbright --max-value=$maxbright --value=$curbright --step 1)
+else
+newbright=$1
+fi
+if [ $newbright -le $minbright ]; then newbright=$minbright; fi
+if [ $newbright -ge $maxbright ]; then newbright=$maxbright; fi
+echo $newbright > $device