From b9135cc3ad746972a6f6f4dd3419bbcda861dd67 Mon Sep 17 00:00:00 2001 From: Michael Mrozek Date: Wed, 21 Jul 2010 00:59:04 +0200 Subject: [PATCH] op_lid: Doesn't do anything while in powersaving-mode op_power: Changed Shutdown Time to 5s from 10s, disabled MHz-Changing (doesn't really save much) op_bright: Changed steps to 5 instead of 10. --- testdata/scripts/op_bright_down.sh | 2 +- testdata/scripts/op_bright_up.sh | 2 +- testdata/scripts/op_lid.sh | 27 ++++++++++++++------------- testdata/scripts/op_power.sh | 18 +++++++++--------- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/testdata/scripts/op_bright_down.sh b/testdata/scripts/op_bright_down.sh index 5030b0b..7668c56 100755 --- a/testdata/scripts/op_bright_down.sh +++ b/testdata/scripts/op_bright_down.sh @@ -1,3 +1,3 @@ #!/bin/bash cur=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness); -echo $(($cur-10)) > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness +echo $(($cur-5)) > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness diff --git a/testdata/scripts/op_bright_up.sh b/testdata/scripts/op_bright_up.sh index b3f45d6..897a58f 100755 --- a/testdata/scripts/op_bright_up.sh +++ b/testdata/scripts/op_bright_up.sh @@ -1,3 +1,3 @@ #!/bin/bash cur=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness); -echo $(($cur+10)) > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness +echo $(($cur+5)) > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness diff --git a/testdata/scripts/op_lid.sh b/testdata/scripts/op_lid.sh index e87e109..af39da9 100755 --- a/testdata/scripts/op_lid.sh +++ b/testdata/scripts/op_lid.sh @@ -2,17 +2,18 @@ #actions done when the lid is closed #only argument is 0 for open 1 for closed -if [ "$1" = "1" ]; then #lid was closed - #/usr/pandora/scripts/op_bright.sh 0 - cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness > /tmp/oldbright - echo 0 > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness -elif [ "$1" = "0" ]; then # lid was opend - maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness) - oldbright=$(cat /tmp/oldbright) - if [ $oldbright -ge 3 ] && [ $oldbright -le $maxbright ]; then - /usr/pandora/scripts/op_bright.sh $oldbright - else - /usr/pandora/scripts/op_bright.sh $maxbright - fi +if [ -e /tmp/powerstate ]; then #do nothing when in powersave mode + if [ "$1" = "1" ]; then #lid was closed + #/usr/pandora/scripts/op_bright.sh 0 + cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness > /tmp/oldbright + echo 0 > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness + elif [ "$1" = "0" ]; then # lid was opend + maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness) + oldbright=$(cat /tmp/oldbright) + if [ $oldbright -ge 3 ] && [ $oldbright -le $maxbright ]; then + /usr/pandora/scripts/op_bright.sh $oldbright + else + /usr/pandora/scripts/op_bright.sh $maxbright + fi + fi fi - diff --git a/testdata/scripts/op_power.sh b/testdata/scripts/op_power.sh index dfee8e5..3aa9830 100755 --- a/testdata/scripts/op_power.sh +++ b/testdata/scripts/op_power.sh @@ -13,17 +13,17 @@ if [ "$1" -le "2" ]; then # button was pressed 1-2sec, "suspend" echo 0 > /tmp/powerstate oldbright=$(cat /tmp/oldbright) maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness) - oldspeed=$(cat /tmp/oldspeed) + #oldspeed=$(cat /tmp/oldspeed) if [ $oldbright -ge 3 ] && [ $oldbright -le $maxbright ]; then /usr/pandora/scripts/op_bright.sh $oldbright else /usr/pandora/scripts/op_bright.sh $maxbright fi - if [ $oldspeed -gt 14 ] && [ $oldspeed -le 900 ]; then - echo $oldspeed > /proc/pandora/cpu_mhz_max - else - echo 500 > /proc/pandora/cpu_mhz_max - fi + #if [ $oldspeed -gt 14 ] && [ $oldspeed -le 900 ]; then + # echo $oldspeed > /proc/pandora/cpu_mhz_max + #else + # echo 500 > /proc/pandora/cpu_mhz_max + #fi hcistate=$(cat /tmp/hcistate) if [ ! $hcistate ]; then hciconfig hci0 up @@ -40,7 +40,7 @@ if [ "$1" -le "2" ]; then # button was pressed 1-2sec, "suspend" else #in normal mode echo 1 > /tmp/powerstate - cat /proc/pandora/cpu_mhz_max > /tmp/oldspeed + #cat /proc/pandora/cpu_mhz_max > /tmp/oldspeed cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness > /tmp/oldbright pidlist=$(pstree -lpA | grep pnd_run.sh | sed -ne 's/.*(\([0-9]\+\))/\1/p') for PID in $pidlist @@ -62,11 +62,11 @@ if [ "$1" -le "2" ]; then # button was pressed 1-2sec, "suspend" /etc/init.d/wl1251-init stop fi echo 0 > /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/brightness - echo 14 > /proc/pandora/cpu_mhz_max + #echo 14 > /proc/pandora/cpu_mhz_max fi elif [ "$1" -ge "3" ]; then #button was pressed 3 sec or longer, shutdown xfceuser=$(ps u -C xfce4-session | tail -n1 | awk '{print $1}') - time=10 + time=5 countdown () { for i in $(seq $time); do precentage=$(echo $i $time | awk '{ printf("%f\n", $1/$2*100) }') -- 2.39.2