sensors/pwmconfig-handle-fan-input-error.patch

30 lines
957 B
Diff

From: Jean Delvare <jdelvare@suse.de>
Subject: pwmconfig: Deal gracefully with unreadable fan inputs
References: boo#1181890
Upstream: not yet, submitted 2021-02-11 but upstream is dead
If a hwmon driver exposes an unreadable fan input, let the user know
and skip that input. Otherwise we hit syntax errors later on.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
prog/pwm/pwmconfig | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- lm-sensors.orig/prog/pwm/pwmconfig 2020-05-07 14:29:34.731733274 +0200
+++ lm-sensors/prog/pwm/pwmconfig 2021-02-11 11:31:40.636126815 +0100
@@ -283,8 +283,11 @@ sleep $DELAY
echo 'Found the following fan sensors:'
for i in $FAN
do
- S=$(cat $i)
- if [ "$S" = "0" -o "$S" = "-1" ]
+ S=$(cat $i 2> /dev/null)
+ if [ $? -ne 0 ]
+ then
+ echo " $i current speed: can't read ... skipping!"
+ elif [ "$S" = "0" -o "$S" = "-1" ]
then
echo " $i current speed: 0 ... skipping!"
else