pwmconfig, fancontrol: Gracefully handle errors when writing to

sysfs files, as bash 3.1 otherwise displays them and this tends to
frighten the user.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4280 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2007-01-05 16:34:32 +00:00
1 parent ac08de0cd3
commit 55e8649c0d
3 files changed
+20 -4

No files matched your search

+1
View File
@@ -25,6 +25,7 @@ SVN HEAD
Program i2cdetect: Make the output clearer
Program py-smbus: New! Python i2c-dev bindings (prog/py-smbus)
Programs dump/*: More robust handling of user inputs
Programs pwmconfig, fancontrol: Handle write errors for bash 3.1
Program sensord: Add pc87247 support (fans only)
Add vt1211 support (#2150)
Add w83627dhg support (David Holl, #2157)
+7 -2
View File
@@ -124,7 +124,7 @@ function pwmdisable()
ENABLE=${1}_enable
if [ -f $ENABLE ]
then
echo 0 > $ENABLE
echo 0 > $ENABLE 2> /dev/null
fi
else
echo $MAX 0 > $1
@@ -139,8 +139,13 @@ function pwmenable()
ENABLE=${1}_enable
if [ -f $ENABLE ]
then
echo 1 > $ENABLE
echo 1 > $ENABLE 2> /dev/null
if [ $? -ne 0 ]
then
return 1
fi
fi
echo $MAX > $1
else
echo $MAX 1 > $1
fi
+12 -2
View File
@@ -99,7 +99,7 @@ function pwmdisable()
ENABLE=${1}_enable
if [ -w $ENABLE ]
then
echo 0 > $ENABLE
echo 0 > $ENABLE 2> /dev/null
fi
else
echo $MAX 0 > $1
@@ -114,8 +114,13 @@ function pwmenable()
ENABLE=${1}_enable
if [ -w $ENABLE ]
then
echo 1 > $ENABLE
echo 1 > $ENABLE 2> /dev/null
if [ $? -ne 0 ]
then
return 1
fi
fi
echo $MAX > $1
else
echo $MAX 1 > $1
fi
@@ -271,6 +276,11 @@ for i in $PWM
do
echo Testing pwm control $i ...
pwmenable $i
if [ $? -ne 0 ]
then
echo "Manual control mode not supported, skipping."
continue
fi
pwmset $i 0
sleep $DELAY
if [ $? -ne 0 ]