From 9bf2d8c187c35d219d22c0701bb7c27dc1088d08 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Tue, 4 Dec 2007 10:21:16 +0000 Subject: [PATCH] Warn about outputs found in automatic mode. git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5063 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 1 + prog/pwm/pwmconfig | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/CHANGES b/CHANGES index b568570d..7fef8d20 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,7 @@ SVN Makefile: No warnings about ld configuration for staged installations pwmconfig: Really hide errors on sysfs writes Deal gracefully with read-only pwm_enable files + Warn about outputs found in automatic mode sensors-detect: Drop PCA9540 detection 3.0.0 (2007-11-24) 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