[PATCH powerd] Fix config_SLEEP_WHEN_LID_CLOSED

Sascha Silbe silbe at activitycentral.com
Wed May 23 16:10:10 EDT 2012


Since 792c7dd3 powerd stays asleep by default while the lid is
closed. That's important for some use cases (putting suspended laptops
inside a charging rack), but breaks config_SLEEP_WHEN_LID_CLOSED=false
unless the new configuration option config_WAKE_WHEN_LID_OPEN has been
explicitly set to true by the user. As this option isn't present in
the configuration file where powerd was updated rather than freshly
installed, it takes them some time to figure out why
config_SLEEP_WHEN_LID_CLOSED doesn't work anymore.

Since the user has no expectation of the laptop going to sleep at all
when closing the lid if config_SLEEP_WHEN_LID_CLOSED is set to false,
it's safe to always enable config_WAKE_WHEN_LID_OPEN in that case.

Signed-off-by: Sascha Silbe <silbe at activitycentral.com>
---
 powerd |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/powerd b/powerd
index a9bba10..657744e 100755
--- a/powerd
+++ b/powerd
@@ -2543,6 +2543,9 @@ read_config()
 
     wake_on_open=$(yes_or_true_to_boolean "$config_WAKE_WHEN_LID_OPENED")
 
+    if [ -z "$sleep_on_close" ] ; then
+	wake_on_open=true
+    fi
 }
 
 battery_shutdown()
-- 
1.7.10




More information about the Devel mailing list