From 6b644025757beecd970a383872c90f451be28ef2 Mon Sep 17 00:00:00 2001 From: Michael Mrozek Date: Fri, 16 Mar 2012 02:44:30 +0100 Subject: [PATCH] op_cpusettings.sh: Shows warning message if user tries to change OPP with experimental kernel --- .../pandora-scripts/op_cpusettings.sh | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/recipes/pandora-system/pandora-scripts/op_cpusettings.sh b/recipes/pandora-system/pandora-scripts/op_cpusettings.sh index aa627a8..3d2a0ec 100755 --- a/recipes/pandora-system/pandora-scripts/op_cpusettings.sh +++ b/recipes/pandora-system/pandora-scripts/op_cpusettings.sh @@ -13,14 +13,19 @@ while mainsel=$(zenity --title="CPU-Settings" --width="400" --height="350" --lis case $mainsel in "opp") - opp="$(cat /etc/pandora/conf/cpu.conf | grep opp | awk -F\: '{print $2}')" - if zenity --question --title="OPP Setting Info" --text="WARNING!\n\nIncreasing the maximum allowed OPP will allow you to overclock to higher values.\n\nHowever, besides using more power, it ALSO DECREASES THE LIFETIME OF YOUR CPU!\n\nBe absolutely sure you know what you are doing here. \n\nThe standard OPP setting is 3, everything above is out of the specification!" --ok-label="Yes, I know what I'm doing!" --cancel-label="I'm scared!"; then - if newopp=$(zenity --scale --text "Set the maximum allowed OPP" --min-value=3 --max-value=5 --value=$opp --step 1); then - echo $newopp > /proc/pandora/cpu_opp_max - sed -i "s/.*maxopp.*/maxopp:$newopp/g" /etc/pandora/conf/cpu.conf - zenity --info --title="OPP Set" --text "The maximum allowed OPP value has been set to $newopp." --timeout 6 - else - zenity --info --title="No change" --text "The maximum OPP value has not been changed." --timeout 6 + kernel_major=`uname -r | cut -c 1` + if [ "$kernel_major" = "3" ]; then + zenity --info --title="OPP not supported" --text "Sorry, the experimental kernel does not support overvolting.\n\nTherefore, you cannot configure these CPU-Settings." + else + opp="$(cat /etc/pandora/conf/cpu.conf | grep opp | awk -F\: '{print $2}')" + if zenity --question --title="OPP Setting Info" --text="WARNING!\n\nIncreasing the maximum allowed OPP will allow you to overclock to higher values.\n\nHowever, besides using more power, it ALSO DECREASES THE LIFETIME OF YOUR CPU!\n\nBe absolutely sure you know what you are doing here. \n\nThe standard OPP setting is 3, everything above is out of the specification!" --ok-label="Yes, I know what I'm doing!" --cancel-label="I'm scared!"; then + if newopp=$(zenity --scale --text "Set the maximum allowed OPP" --min-value=3 --max-value=5 --value=$opp --step 1); then + echo $newopp > /proc/pandora/cpu_opp_max + sed -i "s/.*maxopp.*/maxopp:$newopp/g" /etc/pandora/conf/cpu.conf + zenity --info --title="OPP Set" --text "The maximum allowed OPP value has been set to $newopp." --timeout 6 + else + zenity --info --title="No change" --text "The maximum OPP value has not been changed." --timeout 6 + fi fi fi;; -- 2.39.2