From: Jean Delvare <jdelvare@suse.de>
To: lm-sensors@vger.kernel.org
Subject: [PATCH] pwmconfig: Deal gracefully with unreadable fan inputs
Date: Thu, 11 Feb 2021 12:10:12 +0000 [thread overview]
Message-ID: <20210211131012.2633e64a@endymion> (raw)
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
--
Jean Delvare
SUSE L3 Support
reply other threads:[~2021-02-11 12:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210211131012.2633e64a@endymion \
--to=jdelvare@suse.de \
--cc=lm-sensors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox