OHM power management

From OLPC
(Redirected from Olpc-hardware-manager)
Jump to navigation Jump to search
  This page is monitored by the OLPC team.
  Please copy/paste "{{Translationlist | xx | origlang=en | translated={{{translated}}}}}" (where xx is ISO 639 language code for your translation) to OHM power management/translations HowTo [ID# 259836]  +/-  

About OHM

Ohm was the power management software used by the XO up to OLPC OS 8.2.1 to extend battery life, manage suspend and resume, and provide access to low-level hardware features of the XO, such as backlight levels, and DCON freeze.

From 10.1.0, power management is handled by powerd.

Temporarily inhibiting suspend in an activity

The original source for this code snippet was <trac>7910</trac>.

import dbus

try:
    bus = dbus.SystemBus()
    proxy = bus.get_object('org.freedesktop.ohm',
                           '/org/freedesktop/ohm/Keystore')
    keystore = dbus.Interface(proxy,
                             'org.freedesktop.ohm.Keystore')
    # Find out the current state.
    inhibit = keystore.GetKey('suspend.inhibit')
    print inhibit

    # Set to inhibit.
    keystore.SetKey('suspend.inhibit', 1)
    inhibit = keystore.GetKey('suspend.inhibit')
    print inhibit

    # DO THE THING YOU DIDN'T WANT TO GET INTERRUPTED
    # BY SUSPEND HERE.

    # When done, unset inhibit.
    keystore.SetKey('suspend.inhibit', 0)
    inhibit = keystore.GetKey('suspend.inhibit')
    print inhibit
except dbus.DBusException, e:
    print "Error setting OHM inhibit: %s" % e

Temporarily inhibiting suspend in olpc-update

This is how build 2404 does it.

from bitfrost.update import inhibit_suspend
@inhibit_suspend
def olpc_update(options, args):
 ...

Enabling Idle Suspend

Release 8.2 and later
use the Power module in the sugar control panel to enable or disable suspend. Idle suspend is enabled by default in these releases.
Prior to release 8.2
Idle suspend is disabled by default. In the terminal, type:
sudo rm /etc/ohm/inhibit-idle-suspend
After that, the XO will suspend when you leave the system alone for ~60s.

OHM Policy

  • On momentary power button: turn off screen, suspend machine, leave keyboard and wireless on; keyboard/touchpad will cause instant on again.
  • On lid close on battery, should turn off keyboard, turn off screen, Then should suspend to RAM, including disabling and powering down wireless
  • On lid close on power, leave the machine on and running, turn off the screen, turn off the backlight.
  • On lid open, turn on keyboard, reset keyboard, resume from suspend, turn wireless back on, tell NM to reassociate (maybe only after some delay), try previous association first, of course...
  • On ebook mode, should turn off keyboard #2770
  • On lid open, should reset keyboard #2770
  • On ebook to non-ebook mode, should reset keyboard #2770
  • On external power supply on *or* off, should reset touchpad #1407
  • rotate should probably be done by OHM.

When we are suspended, and the battery wakes us up because it is "low", then: Graceful shutdown after journal has been notified; we may do hibernation someday if enough flash is available.

Task: Tune the default DPMS parameters.

Note: "xset dpms force off" will turn off the screen; this will call the device driver as well as tell X the correct state.

Reset keyboard instructions are in trac.

The big question is: how to do idle?

X DPMS extension? X SS extension? cpuidle kernel patch, about to go mainline in Linux, with module to tell ohm the system has been idle? other ideas?