Hello, find attached a patch that fixes fancontrol to survive a system suspend. If the daemon can not set the pwm values but it did it already in the past successfully, it tries to reenable the pwm output instead of quitting. Regards, Max -- Maximilian Seesslen
Index: prog/pwm/fancontrol =================================================================== --- prog/pwm/fancontrol (Revision 6189) +++ prog/pwm/fancontrol (Arbeitskopie) @@ -42,6 +42,7 @@ #DEBUG=1 MAX=255 +DID_FIRSTRUN=0 function LoadConfig { @@ -490,7 +491,12 @@ if [ $? -ne 0 ] then echo "Error writing PWM value to $DIR/$pwmo" >&2 - restorefans 1 + [ "$DID_FIRSTRUN" == "0" ] && restorefans 1 + # Ignoring write error. System probably was syspended and has to reanable pwm. + echo "Ignoring, i try reanabling PWM." + pwmenable $pwmo + # Write values again to keep failure short + echo $pwmval > $pwmo # write new value to pwm output fi if [ "$DEBUG" != "" ] then @@ -498,6 +504,8 @@ fi let fcvcount=$fcvcount+1 done + + DID_FIRSTRUN=1 } echo 'Enabling PWM on fans...'
From 46940390c8f9fcc4325710867c95b2e28aebaf81 Mon Sep 17 00:00:00 2001 From: Maximilian Seesslen <mes@xxxxxxxxxxxx> Date: Fri, 12 Jul 2013 18:59:49 +0200 Subject: [PATCH] fix fancontrol to survive a system suspend/hibernate --- prog/pwm/fancontrol | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/prog/pwm/fancontrol b/prog/pwm/fancontrol index 2771139..3e57901 100755 --- a/prog/pwm/fancontrol +++ b/prog/pwm/fancontrol @@ -42,6 +42,7 @@ PIDFILE="/var/run/fancontrol.pid" #DEBUG=1 MAX=255 +DID_FIRSTRUN=0 function LoadConfig { @@ -490,7 +491,12 @@ function UpdateFanSpeeds if [ $? -ne 0 ] then echo "Error writing PWM value to $DIR/$pwmo" >&2 - restorefans 1 + [ "$DID_FIRSTRUN" == "0" ] && restorefans 1 + # Ignoring write error. System probably was syspended and has to reanable pwm. + echo "Ignoring, i try reanabling PWM." + pwmenable $pwmo + # Write values again to keep failure short + echo $pwmval > $pwmo # write new value to pwm output fi if [ "$DEBUG" != "" ] then @@ -498,6 +504,8 @@ function UpdateFanSpeeds fi let fcvcount=$fcvcount+1 done + + DID_FIRSTRUN=1 } echo 'Enabling PWM on fans...' -- 1.7.10.4
_______________________________________________ lm-sensors mailing list lm-sensors@xxxxxxxxxxxxxx http://lists.lm-sensors.org/mailman/listinfo/lm-sensors