From f0eba83644cce42fc7aebc88bf890930a14be82a Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Wed, 17 Oct 2012 00:47:59 +0300 Subject: [PATCH] op_gamma: implement switching to user-default gamma --- recipes/pandora-system/pandora-scripts.bb | 2 +- .../pandora-scripts/op_gamma.sh | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/recipes/pandora-system/pandora-scripts.bb b/recipes/pandora-system/pandora-scripts.bb index 599c3b9..32430e8 100644 --- a/recipes/pandora-system/pandora-scripts.bb +++ b/recipes/pandora-system/pandora-scripts.bb @@ -6,7 +6,7 @@ COMPATIBLE_MACHINE = "omap3-pandora" DEPENDS = "zenity dbus" RDEPENDS = "zenity dbus" -PR = "r118" +PR = "r119" SRC_URI = " \ file://op_paths.sh \ diff --git a/recipes/pandora-system/pandora-scripts/op_gamma.sh b/recipes/pandora-system/pandora-scripts/op_gamma.sh index 14440b2..7ac4892 100755 --- a/recipes/pandora-system/pandora-scripts/op_gamma.sh +++ b/recipes/pandora-system/pandora-scripts/op_gamma.sh @@ -7,14 +7,21 @@ if [ ! -e "$SYSFS_DSS_GAMMA" ]; then exit 1 fi -if [ "$1" = "0" ]; then - # set default gamma - # TODO: we could set some user global setting here instead - echo 0 > $SYSFS_DSS_GAMMA - exit 0 +gamma="$@" + +if [ "$gamma" = "0" ]; then + # set user default gamma + gamma="1" + if [ -f /etc/pandora/conf/dssgamma.state ]; then + dssgamma=$(cat /etc/pandora/conf/dssgamma.state) + dssgamma=$(echo "scale=2;$dssgamma / 100" | bc) + if [ -n "$dssgamma" ]; then + gamma=$dssgamma + fi + fi fi -if [ "$1" = "1" ]; then +if [ "$gamma" = "1" -o "$gamma" = "1.00" ]; then # no gamma adjustment echo 0 > $SYSFS_DSS_GAMMA exit 0 @@ -26,4 +33,4 @@ if [ "`which op_gammatable`" = "" ]; then fi # just forward args to op_gammatable -op_gammatable "$@" > /sys/devices/platform/omapdss/display0/dss_gamma +op_gammatable $gamma > $SYSFS_DSS_GAMMA -- 2.39.2