Really hide errors on sysfs writes.

Deal gracefully with read-only pwm_enable files.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5061 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2007-12-04 09:27:49 +00:00
1 parent fc28fe7974
commit 972e5e2f01
2 files changed
+19 -8

No files matched your search

+2
View File
@@ -4,6 +4,8 @@ lm-sensors CHANGES file
SVN
documentation: Update the application writing guidelines
Makefile: No warnings about ld configuration for staged installations
pwmconfig: Really hide errors on sysfs writes
Deal gracefully with read-only pwm_enable files
sensors-detect: Drop PCA9540 detection
3.0.0 (2007-11-24)
+17 -8
View File
@@ -1,6 +1,6 @@
#!/bin/bash
#
# pwmconfig v0.8
# pwmconfig v0.9
# Tests the pwm outputs of sensors and configures fancontrol
#
# Warning!!! This program will stop your fans, one at a time,
@@ -123,7 +123,7 @@ function pwmdisable()
fi
# Try pwmN_enable=0
echo 0 > $ENABLE 2> /dev/null
echo 0 2>/dev/null > $ENABLE
if [ "`cat $ENABLE`" -eq 0 ]
then
# Success
@@ -131,7 +131,7 @@ function pwmdisable()
fi
# It didn't work, try pwmN_enable=1 pwmN=255
echo 1 > $ENABLE 2> /dev/null
echo 1 2>/dev/null > $ENABLE
if [ "`cat $ENABLE`" -ne 1 ]
then
echo "$ENABLE stuck to `cat $ENABLE`" >&2
@@ -161,7 +161,7 @@ function pwmenable()
ENABLE=${1}_enable
if [ -w $ENABLE ]
then
echo 1 > $ENABLE 2> /dev/null
echo 1 2>/dev/null > $ENABLE
if [ $? -ne 0 ]
then
return 1
@@ -195,15 +195,24 @@ do
pwmdisable $i
if [ $? -ne 0 ]
then
echo "Failed to set $i to full speed" >&2
echo "Something's wrong, check your fans!" >&2
exit 1
echo "Manual control mode not supported, skipping $i."
elif [ "$GOODPWM" = "" ]
then
GOODPWM=$i
else
GOODPWM="$GOODPWM $i"
fi
else
NOTROOT=1
fi
done
if [ "$GOODPWM" = "" ]
then
echo 'There are no usable PWM outputs.'
exit 1
fi
echo
echo "Giving the fans some time to reach full speed..."
sleep $DELAY
@@ -343,7 +352,7 @@ function pwmdetail()
echo
}
for i in $PWM
for i in $GOODPWM
do
echo Testing pwm control $i ...
pwmenable $i