From eb40756d744f3b7719314f4386b4992d2f179a13 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 22 Aug 2010 16:07:22 +0000 Subject: [PATCH] When looking for pwm/fan correlations, sample all fans before returning a given PWM output to full speed. The code used to only sample the first fan before doing so, so correlation with other fans could be missed. Problem reported by Charles Pillar. This closes ticket #2380. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5855 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/pwm/pwmconfig | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index 956348a7..e4468a78 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ SVN HEAD libsensors: Increase MAX_SENSORS_PER_TYPE to 24 Map individual beep features Change license to LGPL + pwmconfig: Sample all fan speeds before returning to full speed (#2380) sensors.conf.default: W83667HG config is similar to W83627EHF/DHG sensord: Fix support of multiple chips (#2377) sensors: Properly handle sensor input read errors diff --git a/prog/pwm/pwmconfig b/prog/pwm/pwmconfig index 2754bb53..3f14b2af 100755 --- a/prog/pwm/pwmconfig +++ b/prog/pwm/pwmconfig @@ -437,15 +437,19 @@ do echo '^C received, restoring PWM and aborting...' exit 1 fi + + # Sample all current fan speeds at once, so that we can quickly + # disable PWM and return all fans to full speed + CURRENT_SPEEDS="`cat $GOODFAN`" + pwmdisable $i + let pwmactivecount=0 let count=1 for j in $GOODFAN do OS=`echo $SPEEDS | cut -d' ' -f$count` - # this will return the first field if there's only one (sysfs) - S=`cat $j | cut -d' ' -f2` + S=`echo $CURRENT_SPEEDS | cut -d' ' -f$count` echo " $j ... speed was $OS now $S" - pwmdisable $i let threshold=2*$OS/3 if [ $S -lt $threshold ] then