View Single Post
Posts: 38 | Thanked: 13 times | Joined on Oct 2009
#3539
Updated script to switch profiles based on temperature

What it does -
Probes the temperature every 30 seconds
If the temperature is higher then 45 degrees, switches to the deafult profile (safety measure).
If the temperature is 40-45 degrees, runs on ideal config, with max =850
If the device is cold, starvs the CPU and let it run till 900MHZ.


#!/bin/sh
set old=""
set limits=""
set oldlimits=""
while test 2 -gt 1;
do
modprobe bq27x00_battery
read tmpr </sys/class/power_supply/bq27200-0/temp
if test $tmpr -gt 45;
then new="default";
limits="250 600";
else
if test $tmpr -gt 40;
then
new="ideal";
limits="500 850";
else
new="starving";
limits="500 900"
fi
fi
if test $old!=$new;
then
/usr/sbin/kernel-config load $new;
/usr/sbin/kernel-config limits $limits;
else if test $limits!=$oldlimits
/usr/sbin/kernel-config limits $limits;
fi
fi
old=$new
oldlimits=$limits
sleep 30
done

Last edited by sdpkom; 2010-05-10 at 10:37.
 

The Following 2 Users Say Thank You to sdpkom For This Useful Post: