From b279a9e7363480c20cff202ef659203fddd15a10 Mon Sep 17 00:00:00 2001 From: Michael Mrozek Date: Mon, 12 Apr 2010 03:16:57 +0200 Subject: [PATCH] New Startup-Script: Save and Restore LCD Brightness and Gamma settings --- recipes/pandora-system/pandora-lcd-state.bb | 28 ++++++++++ .../pandora-lcd-state/brightness.state | 1 + .../pandora-lcd-state/gamma.state | 1 + .../pandora-lcd-state/rc.pandora-lcd-state | 55 +++++++++++++++++++ 4 files changed, 85 insertions(+) create mode 100755 recipes/pandora-system/pandora-lcd-state.bb create mode 100644 recipes/pandora-system/pandora-lcd-state/brightness.state create mode 100644 recipes/pandora-system/pandora-lcd-state/gamma.state create mode 100644 recipes/pandora-system/pandora-lcd-state/rc.pandora-lcd-state diff --git a/recipes/pandora-system/pandora-lcd-state.bb b/recipes/pandora-system/pandora-lcd-state.bb new file mode 100755 index 0000000..87d9bdb --- /dev/null +++ b/recipes/pandora-system/pandora-lcd-state.bb @@ -0,0 +1,28 @@ +DESCRIPTION = "Save and restore the brightness and gamma state on shutdown / startup" +LICENSE = "GPLv2" + +COMPATIBLE_MACHINE = "omap3-pandora" + +PR = "r0" +inherit update-rc.d + +INITSCRIPT_NAME = "pandora-lcd-state" +INITSCRIPT_PARAMS = "start 39 S . stop 31 0 1 6 ." + +SRC_URI = " \ + file://rc.pandora-lcd-state \ + file://gamma.state \ + file://brightness.state \ +" + +do_install() { + install -d ${D}${sysconfdir}/init.d/ + install -m 0755 ${WORKDIR}/rc.pandora-lcd-state ${D}${sysconfdir}/init.d/pandora-lcd-state + install -d ${D}${sysconfdir}/pandora/conf/ + install -m 0644 ${WORKDIR}/gamma.state ${D}${sysconfdir}/pandora/conf/gamma.state + install -m 0644 ${WORKDIR}/brightness.state ${D}${sysconfdir}/pandora/conf/brightness.state +} + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +FILES_${PN} += "${prefix} ${datadir}" diff --git a/recipes/pandora-system/pandora-lcd-state/brightness.state b/recipes/pandora-system/pandora-lcd-state/brightness.state new file mode 100644 index 0000000..597975b --- /dev/null +++ b/recipes/pandora-system/pandora-lcd-state/brightness.state @@ -0,0 +1 @@ +35 \ No newline at end of file diff --git a/recipes/pandora-system/pandora-lcd-state/gamma.state b/recipes/pandora-system/pandora-lcd-state/gamma.state new file mode 100644 index 0000000..e5edf04 --- /dev/null +++ b/recipes/pandora-system/pandora-lcd-state/gamma.state @@ -0,0 +1 @@ +105 315 381 431 490 537 579 686 780 837 880 1023 diff --git a/recipes/pandora-system/pandora-lcd-state/rc.pandora-lcd-state b/recipes/pandora-system/pandora-lcd-state/rc.pandora-lcd-state new file mode 100644 index 0000000..a11d656 --- /dev/null +++ b/recipes/pandora-system/pandora-lcd-state/rc.pandora-lcd-state @@ -0,0 +1,55 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: pandora-lcd-state +# Required-Start: #adjust +# Required-Stop: #adjust +# Default-Start: S +# Default-Stop: 0 1 6 +### END INIT INFO + +DESC="OpenPandora Save and Restore LCD Settings" +NAME="pandora-lcd-state" + +d_stop() { + echo "Saving LCD-Settings" + cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness > /etc/pandora/conf/brightness.state + cat /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma > /etc/pandora/conf/gamma.state +} + +d_start() { + echo "Restoring LCD-Settings" + cat /etc/pandora/conf/brightness.state > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness + cat /etc/pandora/conf/gamma.state > /sys/devices/platform/omap2_mcspi.1/spi1.1/gamma +} + +case "$1" in + start) + echo -n "Starting $DESC: $NAME - " + d_start + echo "." + ;; + stop) + echo -n "Stopping $DESC: $NAME - " + d_stop + echo "." + ;; + reload) + echo -n "Reloading $DESC: $NAME - " + d_start + echo "." + ;; + restart|force-reload) + echo -n "Restarting $DESC: $NAME - " + d_stop + sleep 1 + d_start + echo "." + ;; + *) + echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 -- 2.39.5