pnd_run: CPU-Speed can now be set automatically if the user demands it
authorMichael Mrozek <EvilDragon@openpandora.de>
Sat, 14 Aug 2010 23:21:19 +0000 (01:21 +0200)
committerMichael Mrozek <EvilDragon@openpandora.de>
Sat, 14 Aug 2010 23:21:19 +0000 (01:21 +0200)
op_bright_down and op_bright_up: Brightness value will change in smaller
steps brightness is below 20

testdata/scripts/op_bright_down.sh
testdata/scripts/op_bright_up.sh
testdata/scripts/pnd_run.sh

index 7668c56..e69de29 100755 (executable)
@@ -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
index 897a58f..e69de29 100755 (executable)
@@ -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
index caa7598..f9e309c 100755 (executable)
@@ -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