* [lm-sensors] [PATCH] fix fancontrol to survive a system suspend
@ 2013-07-12 17:12 Maximilian Seesslen
0 siblings, 0 replies; only message in thread
From: Maximilian Seesslen @ 2013-07-12 17:12 UTC (permalink / raw)
To: lm-sensors
[-- Attachment #1: Type: text/plain, Size: 273 bytes --]
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
[-- Attachment #2: fix-fancontrol-to-survive-a-system-suspend-hibernate.diff --]
[-- Type: text/x-patch, Size: 829 bytes --]
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...'
[-- Attachment #3: 0001-fix-fancontrol-to-survive-a-system-suspend-hibernate.patch --]
[-- Type: text/x-patch, Size: 1254 bytes --]
From 46940390c8f9fcc4325710867c95b2e28aebaf81 Mon Sep 17 00:00:00 2001
From: Maximilian Seesslen <mes@seesslen.net>
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
[-- Attachment #4: Type: text/plain, Size: 153 bytes --]
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-07-12 17:12 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-12 17:12 [lm-sensors] [PATCH] fix fancontrol to survive a system suspend Maximilian Seesslen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.