From 2c0bbd78167b59a3b1d7ae7c8acc7aa2e087b06f Mon Sep 17 00:00:00 2001 From: David-John Willis Date: Wed, 11 Nov 2009 21:05:50 +0000 Subject: [PATCH] pandora-scripts: Add simple CPU speed script. --- recipes/pandora-system/pandora-scripts.bb | 12 +++++++--- .../pandora-scripts/op_bright.sh | 8 ++++--- .../pandora-scripts/op_cpuclock.desktop | 9 +++++++ .../pandora-scripts/op_cpuclock.sh | 24 +++++++++++++++++++ 4 files changed, 47 insertions(+), 6 deletions(-) create mode 100644 recipes/pandora-system/pandora-scripts/op_cpuclock.desktop create mode 100644 recipes/pandora-system/pandora-scripts/op_cpuclock.sh diff --git a/recipes/pandora-system/pandora-scripts.bb b/recipes/pandora-system/pandora-scripts.bb index 9d5d659..15704c5 100644 --- a/recipes/pandora-system/pandora-scripts.bb +++ b/recipes/pandora-system/pandora-scripts.bb @@ -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 diff --git a/recipes/pandora-system/pandora-scripts/op_bright.sh b/recipes/pandora-system/pandora-scripts/op_bright.sh index fbfa6f0..548e3e5 100644 --- a/recipes/pandora-system/pandora-scripts/op_bright.sh +++ b/recipes/pandora-system/pandora-scripts/op_bright.sh @@ -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 index 0000000..de6a9a9 --- /dev/null +++ b/recipes/pandora-system/pandora-scripts/op_cpuclock.desktop @@ -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 index 0000000..e417f8b --- /dev/null +++ b/recipes/pandora-system/pandora-scripts/op_cpuclock.sh @@ -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) -- 2.39.5