aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/temper
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/temper
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
downloadopenembedded-709c4d66e0b107ca606941b988bad717c0b45d9b.tar.gz
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/temper')
-rw-r--r--recipes/temper/files/init32
-rwxr-xr-xrecipes/temper/files/temper111
-rw-r--r--recipes/temper/temper_0.0.1.bb19
3 files changed, 162 insertions, 0 deletions
diff --git a/recipes/temper/files/init b/recipes/temper/files/init
new file mode 100644
index 0000000000..a5307205cb
--- /dev/null
+++ b/recipes/temper/files/init
@@ -0,0 +1,32 @@
+#! /bin/sh
+# temper - simple init.d temper fan control script - tim.ellis@foonas.org
+set -e
+
+if [ ! -f /usr/sbin/temper ]; then
+ echo -n "Warning: temper fan control script not found. Shutting down"
+ shutdown -h now
+ exit -1
+fi
+
+case "$1" in
+ start)
+ echo -n "Starting temper: "
+ start-stop-daemon -S -b -n temper -a /usr/sbin/temper
+ echo "done"
+ ;;
+ stop)
+ echo -n "Stopping temper: "
+ start-stop-daemon -K -n temper >&- 2>&- &
+ echo "done"
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "Usage: temper { start | stop | restart }" >&2
+ exit 1
+ ;;
+esac
+
+exit 0
diff --git a/recipes/temper/files/temper b/recipes/temper/files/temper
new file mode 100755
index 0000000000..16d7d98bef
--- /dev/null
+++ b/recipes/temper/files/temper
@@ -0,0 +1,111 @@
+#!/bin/sh
+# /usr/sbin/temper - Thecus F75375 fan control script
+#
+# v1: From community n2100 fan control script (who is the author?)
+# v2: Moved to a separate n1200 version
+# v3: Hacked to work on both n1200 and n2100
+
+# Fan controller
+F75375=`find /sys -name 0-002e | grep i2c-0`
+PWM1=$F75375/pwm1
+
+# Chip temperature values, maximum allowed temp. and temp. log threshold
+CHIPS=$F75375/temp?_input
+TC_CRIT=70
+TC_MAX=60
+TC_THRESH=55
+
+# Disk devices and maximum allowed temp. and temp. log threshold
+DISKS=/dev/sd?
+TD_CRIT=70
+TD_MAX=60
+TD_THRESH=55
+
+# Fan device, lowest PWM value and control range
+FAN=$F75375/pwm1
+FAN_MIN=0
+FAN_RNG=140
+
+# Minimum temp
+TMP_MIN=32
+
+# Logging interval, in minutes. Keep this above the hard disk spin
+# down time this will only log when above log thresholds(s)
+LOG=1
+
+# Enable the fan
+echo 1 > $F75375/pwm1_enable
+
+echo $$ > /var/run/temper.pid
+
+while true ; do
+i=0
+while [ $i -lt $LOG ] ; do
+ i=$(($i+1))
+ # read the disk temperatures every minute
+ TD=0
+ for D in $DISKS ; do
+ t=$(hddtemp -q -n $D)
+ if [ $t -gt $TD ] ; then
+ TD=$t
+ fi
+ done
+
+ j=0
+ while [ $j -lt 6 ] ; do
+ j=$(($j+1))
+ # read the chip temperatures every 10 seconds
+ TC=0
+ for C in $CHIPS ; do
+ t=$(($(cat $C)/1000))
+ if [ $t -gt $TC ] && [ $t -lt 255 ]; then
+ TC=$t
+ fi
+ done
+
+ FC=$(((($TC-$TMP_MIN)*$FAN_RNG)/($TC_MAX-$TMP_MIN)+$FAN_MIN))
+
+ if [ $TC -gt $TC_MAX ] ; then
+ FC=255
+ elif [ $FC -gt $(($FAN_MIN+$FAN_RNG)) ] ; then
+ FC=$FAN_MAX
+ elif [ $FC -lt $FAN_MIN ] ; then
+ FC=$FAN_MIN
+ fi
+
+ FD=$(((($TD-$TMP_MIN)*$FAN_RNG)/($TD_MAX-$TMP_MIN)+$FAN_MIN))
+
+ if [ $TD -gt $TD_MAX ] ; then
+ FD=255
+ elif [ $FD -gt $(($FAN_MIN+$FAN_RNG)) ] ; then
+ FD=$FAN_MAX
+ elif [ $FD -lt $FAN_MIN ] ; then
+ FD=$FAN_MIN
+ fi
+
+ if [ $FC -gt $FD ] ; then
+ F=$FC
+ else
+ F=$FD
+ fi
+
+ if [ "$1" = "-m" ] ; then
+ echo "chips $TC disks $TD -> fan $F"
+ exit 0
+ fi
+ echo $F >$FAN
+ # echo 0 >$PWM1
+
+ sleep 10
+ done
+
+done
+
+# If we are over our mid range tempterature thresholds log to syslog
+if [ $TC -gt $TC_THRESH ] || [ $TD -gt $TD_THRESH ] ; then
+ logger -p daemon.notice temper "- chips $TC, disks $TD -> fan $F"
+fi
+
+done
+
+# EOF
diff --git a/recipes/temper/temper_0.0.1.bb b/recipes/temper/temper_0.0.1.bb
new file mode 100644
index 0000000000..2d6679dc9b
--- /dev/null
+++ b/recipes/temper/temper_0.0.1.bb
@@ -0,0 +1,19 @@
+DESCRIPTION = "A fan control script for the Thecus n1200 or n2100"
+SECTION = "console/network"
+PR = "r1"
+LICENSE = "GPL"
+COMPATIBLE_MACHINE = "(n1200|n2100)"
+RDEPENDS = "hddtemp"
+
+SRC_URI = "file://temper \
+ file://init"
+
+inherit update-rc.d
+
+INITSCRIPT_NAME = "temper"
+INITSCRIPT_PARAMS = "defaults"
+
+do_install() {
+ install -D -m 0755 ${WORKDIR}/temper ${D}/usr/sbin/temper
+ install -D -m 0755 ${WORKDIR}/init ${D}${sysconfdir}/init.d/temper
+}