[PATCH] add set_dcon_freeze()

Bernardo Innocenti bernie
Wed Jun 13 20:33:42 EDT 2007


This is part of a masterplan to implement #621 .
---
 hardwaremanager.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/hardwaremanager.py b/hardwaremanager.py
index 3eeed82..478d428 100755
--- a/hardwaremanager.py
+++ b/hardwaremanager.py
@@ -40,6 +40,7 @@ _KEYBOARD_BRIGHTNESS_KEY = '/sys/class/leds/olpc:keyboard/brightness'
 _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'
+_DCON_FREEZE_KEY = '/sys/devices/platform/dcon/freeze'
 _POWER_STATE_KEY = '/sys/power/state'
 
 class HardwareManagerService(dbus.service.Object):
@@ -58,6 +59,19 @@ class HardwareManagerService(dbus.service.Object):
             logging.error('Cannot write DCON source to sysfs.')
 
     @dbus.service.method(HARDWARE_MANAGER_INTERFACE,
+                         in_signature='b', out_signature='')
+    def set_dcon_freeze(self, frozen):
+        try:
+            f = open(_DCON_FREEZE_KEY, 'w')
+            if frozen:
+                f.write('1')
+            else:
+                f.write('0')
+            f.close()
+        except IOError:
+            logging.error('Cannot write DCON freeze to sysfs.')
+
+    @dbus.service.method(HARDWARE_MANAGER_INTERFACE,
                          in_signature='i', out_signature='')
     def set_display_mode(self, mode):
         if mode != COLOR_MODE and mode != BLACK_AND_WHITE_MODE:
-- 
1.5.2





-- 
   // Bernardo Innocenti
 \X/  http://www.codewiz.org/



More information about the Sugar-devel mailing list