Regulace otáček ventilátoru PC

Pavel Troller patrol@sinus.cz
Středa Leden 7 14:55:40 CET 2009


> Ne, je tam Linux
> 
Tím lépe!
(uvádím jako příklad, konkrétní hodnoty, adresy atd. je možná potřeba změnit)

#!/bin/bash
# fand - the fan daemon
# Stops the CPU fans if the temperature falls below the lower limit.

FANCONTROL=/sys/bus/i2c/devices/9191-0290/pwm1          # The fan control port
TEMP1=/sys/bus/i2c/devices/9191-0290/temp2_input        # CPU0 temp sensor
TEMP2=/sys/bus/i2c/devices/9191-0290/temp3_input        # CPU1 temp sensor
LOWTEMP=60000   # 60C, Stop the fans if the temperature is below this
MIDTEMP=70000   # 70C, Medium rotation of the fans
HIGHTEMP=80000  # 80C, Maximum rotation of the fans if the temperature is above this

while true ; do
   T1=`cat $TEMP1`; T2=`cat $TEMP2`                                     # Get the raw temperatures
   if [ $T1 -gt $T2 ] ; then ACTTEMP=$T1 ; else ACTTEMP=$T2 ; fi        # Select the bigger one
     if [ $ACTTEMP -le $LOWTEMP ]  ; then echo 0   >$FANCONTROL ;
   elif [ $ACTTEMP -gt $HIGHTEMP ] ; then echo 255 >$FANCONTROL ;
   elif [ $ACTTEMP -le $MIDTEMP -a `cat $FANCONTROL` -eq 255 ] ; then echo 2 >$FANCONTROL ;
   elif [ $ACTTEMP -gt $MIDTEMP -a `cat $FANCONTROL` -eq 0 ] ; then echo 255 >$FANCONTROL ; sleep 0.25 ; echo 2 >$FANCONTROL
     fi
   sleep 5
done



Další informace o konferenci Hw-list