pandora-scripts: Add simple CPU speed script.
authorDavid-John Willis <John.Willis@Distant-earth.com>
Wed, 11 Nov 2009 21:05:50 +0000 (21:05 +0000)
committerDavid-John Willis <John.Willis@Distant-earth.com>
Wed, 11 Nov 2009 21:05:50 +0000 (21:05 +0000)
recipes/pandora-system/pandora-scripts.bb
recipes/pandora-system/pandora-scripts/op_bright.sh
recipes/pandora-system/pandora-scripts/op_cpuclock.desktop [new file with mode: 0644]
recipes/pandora-system/pandora-scripts/op_cpuclock.sh [new file with mode: 0644]

index 9d5d659..15704c5 100644 (file)
@@ -3,18 +3,24 @@ LICENSE = "GPLV2"
 
 COMPATIBLE_MACHINE = "omap3-pandora"
 
-PR = "r0"
+PR = "r2"
 
 SRC_URI = " \
           file://op_bright.sh \
           file://op_bright.desktop \
+          file://op_cpuspeed.sh \
+          file://op_cpuspeed.desktop \          
 "
 
 do_install() {
           install -d ${D}${prefix}/pandora/scripts/
-          install -m 0755 ${S}/op_bright.sh ${D}${prefix}/pandora/scripts/
+          install -m 0755 ${WORKDIR}/op_bright.sh ${D}${prefix}/pandora/scripts/
+          install -m 0755 ${WORKDIR}/op_cpuspeed.sh ${D}${prefix}/pandora/scripts/          
           install -d ${D}${datadir}/applications/
-          install -m 0644 ${S}/op_bright.desktop ${D}${datadir}/applications/
+          install -m 0644 ${WORKDIR}/op_bright.desktop ${D}${datadir}/applications/
+          install -m 0644 ${WORKDIR}/op_cpuspeed.desktop ${D}${datadir}/applications/          
 }
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+FILES_${PN} += "${prefix} ${datadir}"
\ No newline at end of file
index fbfa6f0..548e3e5 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #get value range
 minbright=3
 maxbright=$(cat /sys/devices/platform/twl4030-pwm0-bl/backlight/twl4030-pwm0-bl/max_brightness)
@@ -9,6 +9,8 @@ newbright=$(DISPLAY=0:0 zenity --scale --text "set brightness" --min-value=$minb
 else
 newbright=$1
 fi
-if [ $newbright -le $minbright ]; then newbright=$minbright; fi
-if [ $newbright -ge $maxbright ]; then newbright=$maxbright; fi
+if [ $newbright ]; then
+        if [ $newbright -le $minbright ]; then newbright=$minbright; fi
+        if [ $newbright -ge $maxbright ]; then newbright=$maxbright; fi
+fi
 echo $newbright > $device
diff --git a/recipes/pandora-system/pandora-scripts/op_cpuclock.desktop b/recipes/pandora-system/pandora-scripts/op_cpuclock.desktop
new file mode 100644 (file)
index 0000000..de6a9a9
--- /dev/null
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=Set CPU speed
+Comment=Under of overclock your pandoras cpu.
+StartupNotify=false
+Exec=/usr/pandora/scripts/op_cpuclock.sh
+Icon=Terminal
+Terminal=false
+Type=Application
+Categories=System;
diff --git a/recipes/pandora-system/pandora-scripts/op_cpuclock.sh b/recipes/pandora-system/pandora-scripts/op_cpuclock.sh
new file mode 100644 (file)
index 0000000..e417f8b
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/bash
+#get value range
+minmhz=100
+safemhz=600
+maxmhz=900 
+curmhz=$(cat /proc/pandora/cpu_mhz_max)
+device=/proc/pandora/cpu_mhz_max
+if [ ! $1 ]; then
+newmhz=$(DISPLAY=0:0 zenity --scale --text "set cpu mhz" --min-value=$minmhz --max-value=$maxmhz --value=$curmhz --step 1)
+else
+newmhz=$1
+fi
+if [ $newmhz ]; then
+       if [ $newmhz -ge $safemhz ]; then
+               answer=$(DISPLAY=0:0 zenity --question --title "Alert" --text "You are trying to set the cpu clock to $newmhz which is above its specification of $safemhz, doing so will may burn down your house, sour milk, or just blow up (ok, not that likely)! proceed?";echo $?)
+               echo $answer
+               if [ $answer = 1 ]; then exit 1; fi
+       fi
+       if [ $newmhz -le $minmhz ]; then newmhz=$minmhz; fi
+       if [ $newmhz -ge $maxmhz ]; then newmhz=$maxmhz; fi
+fi
+echo $newmhz > $device
+echo cpu_mhz_max set to $(cat /proc/pandora/cpu_mhz_max)