X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=openpandora.oe.git;a=blobdiff_plain;f=recipes%2Fpandora-system%2Fpandora-scripts%2Fop_power.sh;h=35e01cff5181c0d96982a76190ac67f50ed3103b;hp=85843d89693420f711b7f44b269813c39d8030b3;hb=cb697bb996561aaeeb561c1ec54a29e1e7c5fdbd;hpb=67924ef67b367505ad78403ba558ac104bb9c118 diff --git a/recipes/pandora-system/pandora-scripts/op_power.sh b/recipes/pandora-system/pandora-scripts/op_power.sh index 85843d8..35e01cf 100644 --- a/recipes/pandora-system/pandora-scripts/op_power.sh +++ b/recipes/pandora-system/pandora-scripts/op_power.sh @@ -109,6 +109,7 @@ lowPowerOn(){ #switch from normal to lowpower mode lowPowerOff(){ # switch from lowpower to normal mode oldspeed=$(cat /tmp/oldspeed) /usr/pandora/scripts/op_cpuspeed.sh -n $oldspeed + rm -f /tmp/oldspeed display_on resume_net @@ -121,6 +122,18 @@ lowPowerOff(){ # switch from lowpower to normal mode echo 255 > /sys/class/leds/pandora\:\:power/brightness #power LED bright } +display_on_with_checks() { + # after turning on the display, we don't want lowpower state + # (which could be active because of some races) + if [ "$powerstate" = "buttonlowpower" -o "$powerstate" = "lidlowpower" -o \ + -e /tmp/oldspeed ] + then + lowPowerOff + else + display_on + fi +} + show_message() { # TODO: check if desktop is visible; maybe use layer3? xfceuser=$(ps u -C xfce4-session | tail -n1 | awk '{print $1}') @@ -277,7 +290,7 @@ elif [[ "$2" == "lid" ]]; then powerstate="on" ;; *) - (debug && echo "display_on") || display_on + (debug && echo "display_on") || display_on_with_checks powerstate="on" ;; esac @@ -305,7 +318,8 @@ elif [[ "$2" == "screensaver" ]]; then unset DISPLAY if [[ "$1" == 0 ]]; then # deactivate screensaver - display_on + display_on_with_checks + powerstate="on" elif [[ "$1" == 1 ]]; then # activate screensaver display_off fi