Eeefan : controle des ventilateurs

Publié le par Levi59

Il s'agit d'un script permettant de gérer plus efficacement la vitesse du ventilateur de votre PC portable.

 

Télécharger le script

 

Il suffit de créer le fichier S99eeefan :

gksudo gedit /etc/rc2.d/S99eeefan

 

et d'y copier ceci :

#!/bin/bash
# By Le Chap (Forum UBUNTU-FR)
# Automatic fan controller
# Tested on a eeepc 901 running Ubuntu 9.10 Karmic Koala
# and eeepc 1005-ha running Crunchbang

# Test with 'sudo ./eeefan background'.
# If works, 'sudo cp eeefan /etc/rc2.d/S99eeefan'
# and reboot.

TEMP=0
# ATTENTION À BIEN METTRE LES BONS CHEMINS AUX FICHIERS SUIVANTS :
temperature_reading=/sys/devices/virtual/thermal/thermal_zone0/temp
fan_control=/sys/devices/platform/eeepc/hwmon/hwmon1/pwm1
fan_manual_switch=/sys/devices/platform/eeepc/hwmon/hwmon1/pwm1_enable

# Set critical temperature
TEMP_CRITICAL=57

# Set critical temperature interval size. See figure for details
TEMP_INTERVAL_SIZE=5

# Maximum fan speed
FAN_SPEED_MAX=75

# Turn on manual fan control
echo 1 > $fan_manual_switch

eeefanupdate() {
TTEMP=$TEMP
# Get temperature reading
TEMP=$(cat $temperature_reading)
TEMP=$(($TEMP / 1000))

if [ $TTEMP != $TEMP ]; then
# Calculate optimum fan speed
X=$(echo "$FAN_SPEED_MAX*1/(1+e(-($TEMP-$TEMP_CRITICAL)/$TEMP_INTERVAL_SIZE))" | bc -q -l)
# Workaround to convert it to nearest integer
FAN_SPEED=$(echo "scale=0; $X/1.0" | bc -q -l)
# Set fan speed
FAN_SPEED=$(($FAN_SPEED * 250 / 100))
echo $FAN_SPEED > $fan_control
fi
}

# Run eeefanupdate, then wait 10 seconds.
while [ 1 ]
do
eeefanupdate
sleep 10
done
exit 0;

 

Puis de le rendre exécutable :

sudo chmod +x /etc/rc2.d/S99eeefan

 

La modification sera effective après un redémarrage.

Publié dans Outils

Pour être informé des derniers articles, inscrivez vous :
Commenter cet article