From c8f47827ab920f7b3cd609b7998b02a275bc1069 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 4 Dec 2007 10:28:14 +0000 Subject: [PATCH] Warn about outputs found in automatic mode. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5064 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/pwm/pwmconfig | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) 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