Hi,

Here's a patch to allow going to full kernel suspend ("S3") via the
hardware-manager.  It applies on top of the previous DCON patch.

Note that this allows a non-root process to take us into suspend; I
don't see a way around this while we're having individual activities
tell us when suspend is appropriate, rather than working it out for
ourselves.  Again, the first caller of this will be Read.activity,
but anything that only updates itself in response to user input
would be appropriate later.

Thanks!

- Chris.

--- hardware-manager/hardwaremanager.py.orig	2007-05-10 22:26:46.000000000 -0400
+++ hardware-manager/hardwaremanager.py	2007-05-10 22:25:54.000000000 -0400
@@ -40,6 +40,7 @@
 _DISPLAY_BRIGHTNESS_KEY = '/sys/class/backlight/dcon-bl/brightness'
 _DISPLAY_MODE_KEY = '/sys/devices/platform/dcon/output'
 _DCON_SOURCE_KEY = '/sys/devices/platform/dcon/source'
+_POWER_STATE_KEY = '/sys/power/state'
 
 class HardwareManagerService(dbus.service.Object):
     @dbus.service.method(HARDWARE_MANAGER_INTERFACE,
@@ -123,6 +124,17 @@
 
         return enabled
 
+    @dbus.service.method(HARDWARE_MANAGER_INTERFACE,
+                         in_signature='', out_signature='')
+    def set_kernel_suspend(self):
+        try:
+            f = open(_POWER_STATE_KEY, 'w')
+            # 'm' == suspend to memory (RAM)
+            f.write('m')
+            f.close()
+        except IOError:
+            logging.error('Cannot write to kernel power state.')
+
 pid_dir = '/var/run/olpc-hardware-manager/'
 if not os.path.isdir(pid_dir):
     try:
-- 
Chris Ball   <[EMAIL PROTECTED]>
_______________________________________________
Sugar mailing list
[email protected]
http://mailman.laptop.org/mailman/listinfo/sugar

Reply via email to