sensors/lm_sensors-r6165-pwmconfig-multiple-fans.diff
Jean Delvare 54ca40543a - lm_sensors-r6163-pwmconfig-raise-threshold.diff: pwmconfig: Raise
the detection threshold to 3/4 (bnc#810344).
- lm_sensors-r6164-pwmconfig-drop-comment.diff: pwmconfig: Drop a
  stray comment.
- lm_sensors-r6165-pwmconfig-multiple-fans.diff:  pwmconfig:
  Properly deal with multiple fan control (bnc#810344).
- lm_sensors-r6172-fancontrol-absolute-paths.diff: fancontrol: Fix
  handling of absolute paths in config (bnc#810344).

- fancontrol.service: Cleanups.
- Add fancontrol.service (bnc#810344).

OBS-URL: https://build.opensuse.org/package/show/Base:System/sensors?expand=0&rev=61
2013-05-23 16:49:01 +00:00

66 lines
1.7 KiB
Diff

Subject: pwmconfig: Properly deal with multiple fan control
Upstream: yes, r6165
References: bnc#810344
When a given PWM output controls more than one fan,
fanactive_min is no longer a space-separated list of numbers, it will
also include items of the form "A+B". The tests in the rest of the
code do not expect that and choke with errors like:
/usr/sbin/pwmconfig: line 926: [: 538+799: integer expression expected
/usr/sbin/pwmconfig: line 952: [: 538+799: integer expression expected
As the only thing we really care about is whether any fan stops
completely when PWM is 0, we can simply record the minimum of the
lowest speed of all affected fans.
---
prog/pwm/pwmconfig | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
--- a/prog/pwm/pwmconfig
+++ b/prog/pwm/pwmconfig
@@ -443,6 +443,7 @@ do
let pwmactivecount=0
let count=1
+ S_MIN=
for j in $GOODFAN
do
OS=`echo $SPEEDS | cut -d' ' -f$count`
@@ -461,7 +462,6 @@ do
let pwmactivecount=1
pwmactive="$i ${pwmactive}"
fanactive="$j ${fanactive}"
- fanactive_min="$S ${fanactive_min}"
# Give all correlated fans time to return to full speed
sleep $DELAY
@@ -472,8 +472,14 @@ do
fi
else
fanactive="$j+${fanactive}"
- fanactive_min="$S+${fanactive_min}"
fi
+
+ # Keep track of the slowest fan controlled by one PWM
+ if [ -z "$S_MIN" ] || [ $S -lt $S_MIN ]
+ then
+ S_MIN=$S
+ fi
+
S=`cat $j`
if [ $S -lt $threshold ]
then
@@ -506,8 +512,11 @@ do
if [ "$X" = "y" -o "$X" = "Y" ]
then
pwmactive="$i ${pwmactive}"
+ fanactive_min="0 $fanactive_min"
fi
echo
+ else
+ fanactive_min="$S_MIN $fanactive_min"
fi
done