diff --git a/CHANGES b/CHANGES index 92e68328..9b712dea 100644 --- a/CHANGES +++ b/CHANGES @@ -18,6 +18,7 @@ SVN-HEAD Give the fans some time to spin up Really hide errors on sysfs writes Deal gracefully with read-only pwm_enable files + Warn about outputs found in automatic mode Program sensors: Hide spurious errors on missing f71872f voltage inputs Hide spurious errors on missing adm1026 inputs Program sensors-detect: Add Texas Instruments TMP401 detection diff --git a/prog/pwm/pwmconfig b/prog/pwm/pwmconfig index 98ffbc19..f2a67208 100755 --- a/prog/pwm/pwmconfig +++ b/prog/pwm/pwmconfig @@ -109,6 +109,21 @@ function print_devices() done } +# $1 = pwm file name +function is_pwm_auto() +{ + if [ -n "$SYSFS" ] + then + ENABLE=${1}_enable + if [ -f $ENABLE -a "`cat $ENABLE`" -gt 1 ] + then + return 0 + fi + fi + + return 1 +} + # $1 = pwm file name function pwmdisable() { @@ -192,6 +207,20 @@ do echo " $i" if [ -w $i ] then + # First check if PWM output is in automatic mode + if is_pwm_auto $i + then + echo "$i is currently setup for automatic speed control." + echo 'In general, automatic mode is preferred over manual mode, as' + echo 'it is more efficient and it reacts faster. Are you sure that' + echo -n 'you want to setup this output for manual control? (n) ' + read X + if [ "$X" = "" -o "$X" != "y" -a "$X" != "Y" ] + then + continue + fi + fi + pwmdisable $i if [ $? -ne 0 ] then