announce: alternate power management

pgf at laptop.org pgf at laptop.org
Thu Mar 19 16:14:35 EDT 2009


okay, if i don't quit playing with this thing and get the taxes
done, my wife will kill me.

so:  i've packaged a new version of powerd.  the big change
is that it now allows for the two modes of operation i mentioned
last week on the list:
                dim
                sleep, screen on
                sleep, screen off
                shutdown
or:
                dim
                screen off
                sleep, screen off
                shutdown

(in contrast, the current releases only really support
		dim
		sleep, screen on
after that you have to do things manually.)

in addition, powerd can use a completely different configuration
profile when running in ebook mode -- in fact, you can have multiple
profiles (you know you've always wanted a different power behavior
when taking your laptop to the beach, right?) and switch between
them pretty easily.

there's also a (very) primitive configuration utility that lets
you select the major configuration parameters.  (it's dialog-based,
so it's curses-based graphics.  you've been warned.)

by default, power management is only active when you're running
on battery.  that's selectable.

the big items listed under "unimplemented" down below are still
unimplemented.  don't know when i'll get to them.

enjoy.  please try it, please let me know what you find.  i've
seen a few anomolies while playing with it -- most of which i
think i've fixed.  but there may well be more, since i think i've
seen at least one i still can't really explain.  (but it was
after a couple of glasses of wine, so who knows.)

code:
      http://dev.laptop.org/git/users/pgf/powerd/
rpms:
      http://dev.laptop.org/~pgf/rpms/

paul



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 Devel mailing list