[Sugar-devel] announce: alternate power management

pgf at laptop.org pgf at laptop.org
Wed Apr 1 10:40:59 EDT 2009


peter wrote:
 > This looks quite interesting. Have you looked at what Fedora is
 > introducing with DeviceKit-power and fellows in Fedora 11. It would be
 > interesting to see the similarities in features to help minimise
 > duplication of effort and to piggy back off Redhat's development
 > resources. They are using it to push alot of the functionality of
 > gnome-power-manager lower down into the stack which in turn means any
 > device such as servers/kde/whatever can make use of it. More details
 > can be seen here https://fedoraproject.org/wiki/Features/DeviceKit

that's the great thing about linux -- just when we finally
develop a standard way of doing things, someone steps in and
says, "no, that was wrong, let's do it this way instead", and
stops supporting or improving the old way.  i was just in the
process of reluctantly integrating olpc-kbdshim with hal, since
it turns out that's the path of least resistance to detecting
user activity on removeable USB devices.  but now that i learn
that hal has been pronounced obsolescent, i suppose i'll just put
this all on the shelf for a year or two, and wait for the new
infrastructure to be ready.

that sarcasm aside, i see no reason that at some point powerd
couldn't use some of the facilities listed here:
    http://hal.freedesktop.org/docs/DeviceKit-power/
as a means to become more generic.  (at the cost of becoming
slower, of course -- we would be replacing simple reads of fixed
nodes in /sys with dbus calls to a daemon which would do those
simple reads of fixed nodes for us.)

my goal with powerd was simplicity, and with specific support of
the XO.  there are some small complexities dealing with things
like USB devices, as mentioned above, and with making sure we can
put up splash screens in a timely manner, but overall, it really
is pretty simple.  i don't intend (in the near term, if ever) to
balloon it with generic support for problems we don't have. 
(especialy when it's not clear anyone will ever use it!  :-)

thanks for the heads-up, though -- i wasn't aware of devicekit.

paul

 > 
 > Peter
 > 
 > On Fri, Mar 13, 2009 at 10:33 PM,  <pgf at laptop.org> wrote:
 > > hi --
 > >
 > > i had an itch that needed scratching, and the result is a
 > > reimplementation of much (but not all) of what ohmd does
 > > currently.
 > >
 > > i've thought for some time (and i believe cjb agrees) that ohmd
 > > is needlessly difficult to maintain and modify for our purposes
 > > on the XO.  small improvements are difficult to implement
 > > quickly.
 > >
 > > since my heart is with more quasi-embedded systems than the XO's
 > > current incarnation, part of my goal was to do a rewrite which
 > > was not dependent on hald, dbus, or X11 -- power management
 > > should work well from a console screen, and be available even if
 > > none of those services is running.
 > >
 > > i call the service i wrote "powerd".  it gets user idle/active
 > > reports from the olpc-kbdshim daemon (which is watching all
 > > user keypress and touchpad activity in any case), and it gets
 > > reports regarding the hardware inputs (power button, lid and
 > > ebook switches, ac adapter status, battery level, etc) either
 > > from another small daemon that monitors /dev/input/event{0,1,2},
 > > or from /sys nodes directly.
 > >
 > > it basically recreates ohmd's "dim after a bit, then sleep"
 > > behavior, with some additions:
 > >
 > >  - a power button splash screen:  a second press of the power
 > >     button invokes shutdown, simply waiting for a brief timeout
 > >     invokes suspend, and any user activity cancels.  (i even
 > >     managed to kinda sorta convey all that with graphics.  i'm
 > >     sure every UI person that sees it will roll their eyes.)
 > >
 > >  - configurable timeouts for screen dim and sleep.  the dim
 > >    level is configurable.
 > >
 > >  - different power management behavior when on wall power vs.
 > >    battery -- many laptop owners don't need to be miserly with
 > >    power when running from an external source.  powerd makes
 > >    this behavior selectable.
 > >
 > >  - different power behavior when in ebook mode (though detection
 > >    may be unreliable -- i think the ebook switch suffers from
 > >    some issues we previously noticed with the lid switch).  this
 > >    should let you configure things like a very short timeout until
 > >    idle-suspend, and/or no screen dimming, when in ebook mode.  (i
 > >    find the frequent on/off nature of the backlight when reading
 > >    in ebook mode to be a distraction.)
 > >
 > >  - clean shutdown on critically low battery.  (currently set at
 > >    a reported 5%, at which point my laptop would only run for
 > >    another couple of minutes.)
 > >
 > >  - the ability to run arbitrary scripts after a resume.  (perhaps
 > >    to reinit usb devices that don't suspend/resume properly?  haven't
 > >    used this much yet.)
 > >
 > >  - ease of customization, given that it's written in everyone's
 > >    favorite interpreted language.
 > >
 > >  unimplemented:
 > >
 > >  - inhibiting idle suspend based on system or network load.
 > >    i.e., the system will dim or suspend when watching a video.
 > >    (there are hooks in place where these features should be
 > >    implemented -- they're just not coded at all.)  there's
 > >    no /etc/ohmd directory, so it honors /var/run/inhibit-idle-suspend
 > >    instead.
 > >
 > >  - no special support for the wireless mesh, whatsoever.  i
 > >    couldn't remember how it was supposed to work, and i recall
 > >    cjb saying it's hard to figure out whether the mesh is active
 > >    or not.
 > >
 > >  - there's some support for wake-on-wlan, but it's not well tested.
 > >
 > >  finally a big one:
 > >  - proper support for USB keyboards and mice.  i recently
 > >    realized that since olpc-kbdshim only monitors the built-in
 > >    keyboard and touchpad, powerd will think the user is idle
 > >    while they type on a USB keyboard, and cheerfully suspend
 > >    regardless.  (in my case, most of the time i want to
 > >    auto-suspend is when i'm running on battery, and not using
 > >    external devices, so i sort of forgot about this case.)
 > >
 > > anyway, code is available here:
 > >    http://dev.laptop.org/git/users/pgf/powerd/
 > > and rpms are here:
 > >    http://dev.laptop.org/~pgf/rpms/
 > >
 > > you'll need to install both olpc-kbdshim and olpc-powerd (in that
 > > order).  when installed, olpc-powerd disables ohmd, and reenables
 > > it when uninstalled.  (so it's relatively safe to try.)
 > >
 > > there's no gui or other convenience for configuration --
 > > see/etc/powerd/powerd.conf.  the installed defaults should be
 > > reasonable.  and you'll need to run:
 > >    echo reconfig >/var/run/powerevents
 > > after making changes to the config file.
 > >
 > > paul
 > > =---------------------
 > >  paul fox, pgf at laptop.org
 > > _______________________________________________
 > > Devel mailing list
 > > Devel at lists.laptop.org
 > > http://lists.laptop.org/listinfo/devel
 > >

=---------------------
 paul fox, pgf at laptop.org


More information about the Sugar-devel mailing list