3 minmhz="$(cat /etc/pandora/conf/cpu.conf | grep 'min:' | awk -F\: '{print $2}')"
4 safemhz="$(cat /etc/pandora/conf/cpu.conf | grep 'safe:' | awk -F\: '{print $2}')"
5 maxmhz="$(cat /etc/pandora/conf/cpu.conf | grep 'max:' | awk -F\: '{print $2}')"
6 warn="$(cat /etc/pandora/conf/cpu.conf | grep 'warn:' | awk -F\: '{print $2}')"
7 device=/proc/pandora/cpu_mhz_max
8 curmhz="$(cat $device)"
9 newmhz="$(cat $device)"
11 if [ "$1" = "-n" ]; then
16 if [ ! -e $device ]; then
17 if [ -z "$1" -a -n "$DISPLAY" ]; then
18 zenity --info --title="CPU-Settings not supported" --text \
19 "Sorry, the experimental kernel does not support setting the clockspeed (yet)."
26 newmhz=$(zenity --scale --text "Set CPU clockspeed" --min-value=$minmhz --max-value=$maxmhz --value=$curmhz --step 1)
28 read -p "Please enter the desired clockspeed: " newmhz
34 if ! [ 0 -lt "$newmhz" -a "$newmhz" -lt 10000 ]; then
35 echo "invalid argument: $newmhz"
40 if [ $newmhz -gt $safemhz ]; then
41 if [ $warn != no ]; then
43 answer=$(zenity --question --title "Alert" --text "You are trying to set the CPU clock to $newmhz which is above the warning level of $safemhz, doing so may burn down your house, sour milk, or just blow up (OK, not that likely)! Proceed?";echo $?)
45 if [ $answer = 1 ]; then exit 1; fi
47 answer="n";read -p "You are trying to set the CPU clock to $newmhz which is above the warning level of $safemhz, doing so may burn down your house, sour milk, or just blow up (OK, not that likely)! Proceed? [y/n]" -t 10 answer
49 if [ $answer = n ]; then exit 1; fi
54 if [ $newmhz -le $minmhz ]; then newmhz=$minmhz; fi
55 if [ $newmhz -ge $maxmhz ]; then newmhz=$maxmhz; fi
56 echo $newmhz > $device
57 echo cpu_mhz_max set to $(cat $device)
59 if [ -e /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ]; then
60 # must poke cpufreq so it does the actual clock transition
61 # according to new limits
62 gov=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
63 echo $gov > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
64 if [ "$gov" = "userspace" ]; then
65 echo $[ $newmhz * 1000 ] > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed