diff --git a/prog/pwm/fancontrol b/prog/pwm/fancontrol index 15c084ef..00837538 100755 --- a/prog/pwm/fancontrol +++ b/prog/pwm/fancontrol @@ -60,7 +60,7 @@ function LoadConfig { FCFANS=`egrep '^FCFANS=.*$' $1 | sed -e 's/FCFANS=//g'` MINPWM=`egrep '^MINPWM=.*$' $1 | sed -e 's/MINPWM=//g'` MAXPWM=`egrep '^MAXPWM=.*$' $1 | sed -e 's/MAXPWM=//g'` - + # Check whether all mandatory settings are set if [[ -z ${INTERVAL} || -z ${FCTEMPS} || -z ${MINTEMP} || -z ${MAXTEMP} || -z ${MINSTART} || -z ${MINSTOP} ]] then @@ -75,10 +75,10 @@ function LoadConfig { fi # write settings to arrays for easier use and print them - echo + echo echo "Common settings:" echo " INTERVAL=$INTERVAL" - + let fcvcount=0 for fcv in $FCTEMPS do @@ -149,7 +149,7 @@ function LoadConfig { } if [ -f "$1" ] -then +then LoadConfig $1 else LoadConfig /etc/fancontrol @@ -173,7 +173,7 @@ then else SYSFS=1 DIR=$SDIR - fi + fi fi cd $DIR @@ -268,7 +268,7 @@ function UpdateFanSpeeds { minso=${AFCMINSTOP[$fcvcount]} minpwm=${AFCMINPWM[$fcvcount]} maxpwm=${AFCMAXPWM[$fcvcount]} - + read tval < ${tsens} if [ $? -ne 0 ] then @@ -292,7 +292,7 @@ function UpdateFanSpeeds { then pwmpval=`echo ${pwmpval} | cut -d' ' -f1` fi - + # If fanspeed-sensor output shall be used, do it if [[ -n ${fan} ]] then @@ -309,7 +309,7 @@ function UpdateFanSpeeds { else fanval=1 # set it to a non zero value, so the rest of the script still works fi - + # debug info if [ "$DEBUG" != "" ] then @@ -326,12 +326,12 @@ function UpdateFanSpeeds { echo "pwmpval=$pwmpval" echo "fanval=$fanval" fi - + if (( $tval <= $mint )) then pwmval=$minpwm # below min temp, use defined min pwm elif (( $tval >= $maxt )) then pwmval=$maxpwm # over max temp, use defined max pwm - else + else # calculate the new value from temperature and settings pwmval="(${tval}-${mint})*(${maxpwm}-${minso})/(${maxt}-${mint})+${minso}" if [ $pwmpval -eq 0 -o $fanval -eq 0 ] diff --git a/prog/pwm/fancontrol.8 b/prog/pwm/fancontrol.8 index 1a50743d..45074465 100644 --- a/prog/pwm/fancontrol.8 +++ b/prog/pwm/fancontrol.8 @@ -25,8 +25,8 @@ some fan fails, because you probably won't hear it anymore ;) .SH CONFIGURATION For easy configuration, there's a script -named \fBpwmconfig\fP(8) which lets you interactively write your -configuration file for \fBfancontrol\fP. Alternatively you can write this +named \fBpwmconfig\fP(8) which lets you interactively write your +configuration file for \fBfancontrol\fP. Alternatively you can write this file yourself using the information from this manpage. Since most of you are going to use \fBpwmconfig\fP(8) script, the config @@ -104,7 +104,7 @@ of the time at best. .SH CONFORMING TO lm_sensors-2.x - + .SH SEE ALSO pwmconfig(8), sensors(1). diff --git a/prog/pwm/fancontrol.pl b/prog/pwm/fancontrol.pl index fe7f68b4..2e67acca 100755 --- a/prog/pwm/fancontrol.pl +++ b/prog/pwm/fancontrol.pl @@ -127,7 +127,7 @@ if (!(-d $dir)) } if (!(-d $dir)) - { die("No sensors found! (are the necessary modules loaded?) : + { die("No sensors found! (are the necessary modules loaded?) : $!\n"); } else { @@ -162,7 +162,7 @@ while(1) 1; -################################################################ +################################################################ sub loadconfig($) { my $file = shift; @@ -174,7 +174,7 @@ sub loadconfig($) open(F, $file); - our ($interval, $fctemps, $fcfans, $mintemp, $maxtemp, $minstart, + our ($interval, $fctemps, $fcfans, $mintemp, $maxtemp, $minstart, $minstop); while($_ = ) { @@ -219,7 +219,7 @@ $minstop); } -################################################################ +################################################################ sub pwmdisable($) { my $p = shift; @@ -260,7 +260,7 @@ sub pwmdisable($) } -################################################################# +################################################################# sub pwmenable($) { my $p = shift; @@ -293,7 +293,7 @@ sub pwmenable($) } -################################################################ +################################################################ sub restorefans() { $SIG{TERM} = 'IGNORE'; @@ -315,7 +315,7 @@ sub restorefans() } -############################################################ +############################################################ sub UpdateFanSpeeds() { my $fcvcount = 0; diff --git a/prog/pwm/pwmconfig b/prog/pwm/pwmconfig index 8f3806aa..0e5118d5 100755 --- a/prog/pwm/pwmconfig +++ b/prog/pwm/pwmconfig @@ -55,7 +55,7 @@ then else echo $0: 'No sensors found! (modprobe sensor modules?)' exit 1 - fi + fi fi cd $DIR @@ -315,7 +315,7 @@ function pwmdetail() read X if [ "$X" = "y" -o "$X" = "Y" -o "$X" = "" ] then - PLOT=y + PLOT=y fi fi @@ -336,15 +336,15 @@ function pwmdetail() pwmenable $P while [ $pwm -ge 0 ] do - pwmset $P $pwm + pwmset $P $pwm sleep $PDELAY if [ $? -ne 0 ] then - pwmdisable $P + pwmdisable $P echo '^C received, aborting...' rm -f $TMP1 $TMP2 exit 1 - fi + fi # this will return the first field if there's only one (sysfs) S=`cat $F | cut -d' ' -f2` echo " PWM $pwm FAN $S" @@ -354,7 +354,7 @@ function pwmdetail() fi if [ "$S" = "0" -o "$S" = "-1" ] then - pwmdisable $P + pwmdisable $P echo " Fan Stopped at PWM = $pwm" if [ $pwm -eq $MAX ] then @@ -375,7 +375,7 @@ function pwmdetail() let pwm=$pwm-$STEP fi done - pwmdisable $P + pwmdisable $P if [ "$PLOT" = "y" ] then $PLOTTER $TMP1 @@ -400,7 +400,7 @@ do pwmdisable $i echo '^C received, restoring PWM and aborting...' exit 1 - fi + fi let pwmactivecount=0 let count=1 for j in $GOODFAN @@ -431,7 +431,7 @@ do then echo '^C received, aborting...' exit 1 - fi + fi # this will return the first field if there's only one (sysfs) S=`cat $j | cut -d' ' -f2` if [ $S -lt $threshold ] @@ -586,29 +586,29 @@ function TestMinStart { } function TestMinStop { - echo - echo 'Now we decrease the PWM value in 10-unit-steps.' + echo + echo 'Now we decrease the PWM value in 10-unit-steps.' echo 'Let the fan reach full speed, then press return until the' echo "fan stops spinning. Then enter 'y'." echo 'We will use this value +20 as the minimum speed.' - let fanok=0 - let fanval=$MAX + let fanok=0 + let fanval=$MAX pwmenable $pwms - until [ "$fanok" = "1" ] - do - let fanval=fanval-10 + until [ "$fanok" = "1" ] + do + let fanval=fanval-10 if [ $fanval -lt 0 ] ; then let fanval=0 ; let fanok=1 ; fi - echo -n "Setting $pwms to $fanval..." + echo -n "Setting $pwms to $fanval..." pwmset $pwms $fanval - read FANTEST + read FANTEST if [ "$FANTEST" != "" ] ; then let fanok=1 ; fi - done + done pwmdisable $pwms - let fanval=fanval+20 - if [ $fanval -gt $MAX ] ; then let fanval=$MAX ; fi - echo "OK, using $fanval" + let fanval=fanval+20 + if [ $fanval -gt $MAX ] ; then let fanval=$MAX ; fi + echo "OK, using $fanval" } function SaveConfig { @@ -695,7 +695,7 @@ select pwms in $pwmactive "Change INTERVAL" "Just quit" "Save and quit" "Show co select tempss in $TEMPS "None (Do not affect this PWM output)"; do if [ "$tempss" = "None (Do not affect this PWM output)" ] then - + break; else if [ "$FCTEMPS" = "" ] @@ -730,7 +730,7 @@ select pwms in $pwmactive "Change INTERVAL" "Just quit" "Save and quit" "Show co if [ "$MAXTEMP" = "" ] then MAXTEMP="${pwms}=${XMT}" - else + else MAXTEMP="`echo $MAXTEMP | sed -e \"s/${pwmsed}[^ ]* *//g\"` ${pwms}=${XMT}" fi echo @@ -800,7 +800,7 @@ select pwms in $pwmactive "Change INTERVAL" "Just quit" "Save and quit" "Show co echo break; done ;; - + *) grep $pwm diff --git a/prog/pwm/pwmconfig.8 b/prog/pwm/pwmconfig.8 index 6d50f729..9d6d9ce0 100644 --- a/prog/pwm/pwmconfig.8 +++ b/prog/pwm/pwmconfig.8 @@ -14,12 +14,12 @@ circuitry installed, even if your sensor chip supports PWM. It attempts to briefly stop each fan using the PWM controls. It then attempts to restore each fan to full speed after testing. However, it -is \fBvery important\fP that you physically verify that the fans have +is \fBvery important\fP that you physically verify that the fans have been returned to full speed after the program has completed. .SH WARNING This program will stop your fans, one at a time, for approximately 5 seconds each. -This may cause your processor temperature to rise. Verify that all fans are running +This may cause your processor temperature to rise. Verify that all fans are running at normal speed after this program has exited. .SH CONFORMING TO