From 2b327cd4ada6bad71e926438f6eff4f8f110d034 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 10 Jun 2007 08:05:18 +0000 Subject: [PATCH] Cleanups to fancontrol: * Use let for arithmetic evaluation. Patch taken from the Suse package. * Kill old commented-out code. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4436 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/pwm/fancontrol | 45 ++++----------------------------------------- 2 files changed, 5 insertions(+), 41 deletions(-) diff --git a/CHANGES b/CHANGES index a0a1fca7..d3c65940 100644 --- a/CHANGES +++ b/CHANGES @@ -14,6 +14,7 @@ SVN HEAD Program i2cdump: Use the new I2C block read function Program isadump: Detect when address bit 7 is a busy flag Fix Super-I/O exit sequence for Winbond/Fintek chips + Program fancontrol: Use let for arithmetic evaluation Program pwmconfig: Use smaller steps for low PWM values Program rrd: Support non-i2c devices (hwmon class) Add missing shell declarations diff --git a/prog/pwm/fancontrol b/prog/pwm/fancontrol index 243c6adf..d1007b1c 100755 --- a/prog/pwm/fancontrol +++ b/prog/pwm/fancontrol @@ -2,7 +2,7 @@ # # Simple script implementing a temperature dependent fan speed control # -# Version 0.63 +# Version 0.64 # # Usage: fancontrol [CONFIGFILE] # @@ -188,7 +188,7 @@ function restorefans() do pwmo=${AFCPWM[$fcvcount]} pwmdisable $pwmo - fcvcount=$fcvcount+1 + let fcvcount=$fcvcount+1 done echo 'Verify fans have returned to full speed' exit 1 @@ -287,7 +287,7 @@ function UpdateFanSpeeds { then echo "new pwmval=$pwmval" fi - fcvcount=$fcvcount+1 + let fcvcount=$fcvcount+1 done } @@ -302,7 +302,7 @@ do echo "Error enabling PWM on $DIR/$pwmo" restorefans fi - fcvcount=$fcvcount+1 + let fcvcount=$fcvcount+1 done echo 'Starting automatic fan control...' @@ -313,40 +313,3 @@ do UpdateFanSpeeds sleep $INTERVAL done - -# some old stuff/missing features, will clean this up soon -#if ( test "$regulationtype" = "quad" ) ; then -# while true ; do -# temp=`cat ${temp1} | cut -b 12-13` -# if (( ${temp} < ${mintemp} )) ; -# then pwm=0 -# elif (( ${temp} > ${maxtemp} )) ; -# then pwm=255 -# else -# pwm=`calc "((10/(${maxtemp}-${mintemp})*(${temp}-${mintemp}))^2/1000*(${maxtemp}-${mintemp})*(255-${minspeed})+${minspeed})"` -# #no optimization here for readability (or sloth :)) -# fi ; -# echo $pwm > ${pwm1} ; -# -# sleep 10 ; -# done ; - -#elif ( test "$regulationtype" = "exp" ) ; then - #add support for exponential calculation here - -#else -# pwmconst=$[(255-${minspeed})/(${maxtemp}-${mintemp})] -# while true ; do -# let temp=`cat temp1 | cut -b 12-13` ; -# if (( ${temp} < ${mintemp} )) ; -# then pwm=0 -# elif (( ${temp} > ${maxtemp} )) ; -# then pwm=255 -# else -# pwm=$[(${temp}-${mintemp})*${pwmconst}+${minspeed}] -# fi ; -# echo $pwm > pwm2 ; -# -# sleep 10 ; -# done ; -#fi