From: Grazvydas Ignotas Date: Sat, 14 May 2016 22:18:44 +0000 (+0300) Subject: pandora-scripts: dim the LED on idle too X-Git-Tag: sz_175~10 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=212daac98d5c8a303032190c4883681cd9f32348;p=openpandora.oe.git pandora-scripts: dim the LED on idle too --- diff --git a/recipes/pandora-system/pandora-scripts/led.conf b/recipes/pandora-system/pandora-scripts/led.conf index c85459c..94e1fb7 100644 --- a/recipes/pandora-system/pandora-scripts/led.conf +++ b/recipes/pandora-system/pandora-scripts/led.conf @@ -1,2 +1,3 @@ LowPowerLED:16 HighPowerLED:255 +IdleLED:48 diff --git a/recipes/pandora-system/pandora-scripts/op_power.sh b/recipes/pandora-system/pandora-scripts/op_power.sh index 0401d07..88ca1a8 100644 --- a/recipes/pandora-system/pandora-scripts/op_power.sh +++ b/recipes/pandora-system/pandora-scripts/op_power.sh @@ -7,8 +7,13 @@ xfceuser_home=$(get_user_home) # XXX: better use lockfile (or something), but it's not in current firmware test -e /tmp/op_power.lock && exit 2 touch /tmp/op_power.lock -highpow="$(cat /etc/pandora/conf/led.conf | grep HighPowerLED: | awk -F\: '{print $2}')" -lowpow="$(cat /etc/pandora/conf/led.conf | grep LowPowerLED: | awk -F\: '{print $2}')" + +led_high="$(cat /etc/pandora/conf/led.conf | grep HighPowerLED: | awk -F\: '{print $2}')" +led_low="$(cat /etc/pandora/conf/led.conf | grep LowPowerLED: | awk -F\: '{print $2}')" +led_idle="$(cat /etc/pandora/conf/led.conf | grep IdleLED: | awk -F\: '{print $2}')" +test -z "$led_high" && led_high=255 +test -z "$led_low" && led_low=16 +test -z "$led_idle" && led_idle=48 debug(){ return 1 # 0 when debugging, 1 when not @@ -123,7 +128,7 @@ lowPowerOff(){ # switch from lowpower to normal mode do kill -CONT $PID done - echo $highpow > /sys/class/leds/pandora\:\:power/brightness #power LED bright + echo $led_high > /sys/class/leds/pandora\:\:power/brightness #power LED bright } display_on_with_checks() { @@ -135,6 +140,7 @@ display_on_with_checks() { lowPowerOff else display_on + echo $led_high > /sys/class/leds/pandora\:\:power/brightness fi } @@ -224,7 +230,7 @@ Please do not remove SD cards while pandora is suspended, doing so will corrupt display_on resume_net - echo $highpow > /sys/class/leds/pandora\:\:power/brightness + echo $led_high > /sys/class/leds/pandora\:\:power/brightness # wait here a bit to prevent this script from running again (keep op_power.lock) # in case user did resume using the power switch. @@ -235,7 +241,7 @@ Please do not remove SD cards while pandora is suspended, doing so will corrupt suspend_() { # dim power LED - echo $lowpow > /sys/class/leds/pandora\:\:power/brightness + echo $led_low > /sys/class/leds/pandora\:\:power/brightness if suspend_real; then # resumed already @@ -315,6 +321,7 @@ elif [[ "$2" == "lid" ]]; then ;; *) (debug && echo "display_off") || display_off + echo $led_idle > /sys/class/leds/pandora\:\:power/brightness powerstate="liddisplayoff" ;; esac @@ -330,6 +337,7 @@ elif [[ "$2" == "screensaver" ]]; then powerstate="on" elif [[ "$1" == 1 ]]; then # activate screensaver display_off + echo $led_idle > /sys/class/leds/pandora\:\:power/brightness fi fi