From ac2d2f889b10a4c02419518a730296775a8427cd Mon Sep 17 00:00:00 2001 From: Michael Mrozek Date: Sun, 15 Aug 2010 01:21:19 +0200 Subject: [PATCH] pnd_run: CPU-Speed can now be set automatically if the user demands it op_bright_down and op_bright_up: Brightness value will change in smaller steps brightness is below 20 --- testdata/scripts/op_bright_down.sh | 3 --- testdata/scripts/op_bright_up.sh | 3 --- testdata/scripts/pnd_run.sh | 35 +++++++++++++++++++++++------- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/testdata/scripts/op_bright_down.sh b/testdata/scripts/op_bright_down.sh index 7668c56..e69de29 100755 --- a/testdata/scripts/op_bright_down.sh +++ b/testdata/scripts/op_bright_down.sh @@ -1,3 +0,0 @@ -#!/bin/bash -cur=$(cat /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 897a58f..e69de29 100755 --- a/testdata/scripts/op_bright_up.sh +++ b/testdata/scripts/op_bright_up.sh @@ -1,3 +0,0 @@ -#!/bin/bash -cur=$(cat /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/pnd_run.sh b/testdata/scripts/pnd_run.sh index caa7598..f9e309c 100755 --- a/testdata/scripts/pnd_run.sh +++ b/testdata/scripts/pnd_run.sh @@ -60,15 +60,34 @@ mountPnd() { sudo mkdir -p "/mnt/utmp/${PND_NAME}" # union over the two fi rm /tmp/cpuspeed - if [ ${cpuspeed:-$(cat /proc/pandora/cpu_mhz_max)} -gt $(cat /proc/pandora/cpu_mhz_max) ]; then - cpuselection=$(zenity --title="set cpu speed" --height=240 --list --column "id" --column "Please select" --hide-column=1 --text="$PND_NAME suggests to set the cpu speed to $cpuspeed MHz to make it run properly.\n\n Do you want to change the cpu speed? (current speed: $(cat /proc/pandora/cpu_mhz_max) MHz)" "yes" "Yes, set it to that value" "custom" "Yes, select custom value" "no" "No, don't change the speed") - if [ ${cpuselection} = "yes" ]; then - cat /proc/pandora/cpu_mhz_max > /tmp/cpuspeed + if ! [ -f "${MOUNTPOINT}/pandora/appdata/${PND_NAME}/cpuspeed" ]; then + if [ ${cpuspeed:-$(cat /proc/pandora/cpu_mhz_max)} -gt $(cat /proc/pandora/cpu_mhz_max) ]; then + cpuselection=$(zenity --title="set cpu speed" --height=320 --list --column "id" --column "Please select" --hide-column=1 --text="$PND_NAME suggests to set the cpu speed to $cpuspeed MHz to make it run properly.\n\n Do you want to change the cpu speed? (current speed: $(cat /proc/pandora/cpu_mhz_max) MHz)\n\nWarning: Setting the clock speed above 600MHz can be unstable and it NOT recommended!" "yes" "Yes, set it to $cpuspeed MHz" "custom" "Yes, select custom value" "yessave" "Yes, set it to $cpuspeed MHz and don't ask again" "customsave" "Yes, set it to custom speed and don't ask again" "no" "No, don't change the speed") + if [ ${cpuselection} = "yes" ]; then + cat /proc/pandora/cpu_mhz_max > /tmp/cpuspeed + sudo /usr/pandora/scripts/op_cpuspeed.sh $cpuspeed + elif [ ${cpuselection} = "custom" ]; then + cat /proc/pandora/cpu_mhz_max > /tmp/cpuspeed + sudo /usr/pandora/scripts/op_cpuspeed.sh + elif [ ${cpuselection} = "customsave" ]; then + cat /proc/pandora/cpu_mhz_max > /tmp/cpuspeed + sudo /usr/pandora/scripts/op_cpuspeed.sh + zenity --info --title="Note" --text="Speed saved.\n\nTo re-enable this dialogue, please delete the file\n${MOUNTPOINT}/pandora/appdata/${PND_NAME}/cpuspeed" + cat /proc/pandora/cpu_mhz_max > ${MOUNTPOINT}/pandora/appdata/${PND_NAME}/cpuspeed + elif [ ${cpuselection} = "yessave" ]; then + cat /proc/pandora/cpu_mhz_max > /tmp/cpuspeed + zenity --info --title="Note" --text="Speed saved.\n\nTo re-enable this dialogue, please delete the file\n${MOUNTPOINT}/pandora/appdata/${PND_NAME}/cpuspeed" + sudo /usr/pandora/scripts/op_cpuspeed.sh $cpuspeed + cat /proc/pandora/cpu_mhz_max > ${MOUNTPOINT}/pandora/appdata/${PND_NAME}/cpuspeed + fi + fi + else + cpuspeed=$(cat "${MOUNTPOINT}/pandora/appdata/${PND_NAME}/cpuspeed") + cat /proc/pandora/cpu_mhz_max > /tmp/cpuspeed + echo Setting to CPU-Speed $cpuspeed MHz sudo /usr/pandora/scripts/op_cpuspeed.sh $cpuspeed - elif [ ${cpuselection} = "custom" ]; then - cat /proc/pandora/cpu_mhz_max > /tmp/cpuspeed - sudo /usr/pandora/scripts/op_cpuspeed.sh - fi + + #gksudo --message ", enter your password to allow" "echo $cpuspeed>/proc/pandora/cpu_mhz_max" fi -- 2.39.2