Accepting request 176499 from Base:System

- 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/request/show/176499
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/sensors?expand=0&rev=84
This commit is contained in:
Stephan Kulow 2013-05-27 08:01:49 +00:00 committed by Git OBS Bridge
commit 3d7c5366c0
7 changed files with 183 additions and 0 deletions

13
fancontrol.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=Start fan control, if configured
ConditionFileNotEmpty=/etc/fancontrol
After=lm_sensors.service
[Service]
Type=simple
PIDFile=/var/run/fancontrol.pid
EnvironmentFile=/etc/sysconfig/lm_sensors
ExecStart=/usr/sbin/fancontrol
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,22 @@
Subject: pwmconfig: Raise the detection threshold to 3/4
Upstream: yes, r6163
References: bnc#810344
Detection threshold of 2/3 of the maximum speed is too low, some fans
will slow down to about that speed so controlled fans may be missed.
Use 3/4 as the threshold to avoid these false negatives.
---
prog/pwm/pwmconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/prog/pwm/pwmconfig
+++ b/prog/pwm/pwmconfig
@@ -448,7 +448,7 @@ do
OS=`echo $SPEEDS | cut -d' ' -f$count`
S=`echo $CURRENT_SPEEDS | cut -d' ' -f$count`
echo " $j ... speed was $OS now $S"
- let threshold=2*$OS/3
+ let threshold=3*$OS/4
if [ $S -lt $threshold ]
then
echo " It appears that fan $j"

View File

@ -0,0 +1,19 @@
Subject: pwmconfig: Drop a stray comment
Upstream: yes, r6164
fancontrol supports multiple controlled fans for quite some time now.
---
prog/pwm/pwmconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/prog/pwm/pwmconfig
+++ b/prog/pwm/pwmconfig
@@ -471,7 +471,7 @@ do
exit 1
fi
else
- fanactive="$j+${fanactive}" #not supported yet by fancontrol
+ fanactive="$j+${fanactive}"
fanactive_min="$S+${fanactive_min}"
fi
S=`cat $j`

View File

@ -0,0 +1,65 @@
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

View File

@ -0,0 +1,31 @@
Subject: fancontrol: Fix handling of absolute paths in config
Upstream: yes, r6172
References: bnc#810344
Reported by Marc Ferland. Make DEVPATH and DEVNAME mandatory only when
using relative paths. Optionally support DEVNAME check when using
absolute paths.
---
prog/pwm/fancontrol | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
--- a/prog/pwm/fancontrol
+++ b/prog/pwm/fancontrol
@@ -289,11 +289,16 @@ fi
cd $DIR
# Check for configuration change
-if [ -z "$DEVPATH" -o -z "$DEVNAME" ]
+if [ "$DIR" != "/" ] && [ -z "$DEVPATH" -o -z "$DEVNAME" ]
then
echo "Configuration is too old, please run pwmconfig again" >&2
exit 1
fi
+if [ "$DIR" = "/" -a -n "$DEVPATH" ]
+then
+ echo "Unneeded DEVPATH with absolute device paths" >&2
+ exit 1
+fi
if ! ValidateDevices "$DEVPATH" "$DEVNAME"
then
echo "Configuration appears to be outdated, please run pwmconfig again" >&2

View File

@ -1,3 +1,25 @@
-------------------------------------------------------------------
Thu May 23 18:30:31 CEST 2013 - jdelvare@suse.de
- 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).
-------------------------------------------------------------------
Thu May 23 18:06:50 CEST 2013 - jdelvare@suse.de
- fancontrol.service: Cleanups.
-------------------------------------------------------------------
Sat May 18 11:58:47 UTC 2013 - werner@suse.com
- Add fancontrol.service (bnc#810344).
-------------------------------------------------------------------
Fri Apr 5 12:06:46 UTC 2013 - idonmez@suse.com

View File

@ -30,6 +30,7 @@ Requires: modutils
Source0: http://dl.lm-sensors.org/lm-sensors/releases/lm_sensors-%{version}.tar.bz2
Source1: lm_sensors.init
Source2: baselibs.conf
Source3: fancontrol.service
Patch1: lm_sensors-3.1.1-build.patch
Patch2: lm_sensors-3.0.0-sensord-separate.patch
Patch3: lm_sensors-3.0.0-sysconfig_metadata.patch
@ -39,6 +40,10 @@ Patch6: lm_sensors-r6112-detection-AMD-family-16h.diff
Patch7: lm_sensors-r6113-ITE-IT877x-IT878x-driver.diff
Patch8: lm_sensors-r6117-detection-ITE-IT8752F.diff
Patch9: lm_sensors-r6123-AnalogDev-ADT7410-driver.diff
Patch10: lm_sensors-r6163-pwmconfig-raise-threshold.diff
Patch11: lm_sensors-r6164-pwmconfig-drop-comment.diff
Patch12: lm_sensors-r6165-pwmconfig-multiple-fans.diff
Patch13: lm_sensors-r6172-fancontrol-absolute-paths.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExcludeArch: s390 s390x
@ -146,6 +151,10 @@ Authors:
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%build
RPM_OPT_FLAGS="$RPM_OPT_FLAGS"
@ -168,6 +177,7 @@ make %{?_smp_mflags} PROG_EXTRA:=sensord BUILD_STATIC_LIB:=0 PREFIX=%{_prefix} M
install -m 0755 %{S:1} $RPM_BUILD_ROOT/etc/init.d/lm_sensors
ln -sf /etc/init.d/lm_sensors $RPM_BUILD_ROOT/usr/sbin/rclm_sensors
install -D -m 0644 prog/init/lm_sensors.service %{buildroot}%{_unitdir}/lm_sensors.service
install -D -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/fancontrol.service
%pre
%service_add_pre lm_sensors.service
@ -211,6 +221,7 @@ fi
%files
%defattr(-,root,root)
%{_unitdir}/lm_sensors.service
%{_unitdir}/fancontrol.service
/etc/init.d/lm_sensors
/usr/sbin/rclm_sensors
/usr/bin/*