blino's website

Free software developer and more

... or how to find a way to handle ACPI button events in a user-unfriendly desktop

So, we're switching to pm-utils + HAL + gnome-power-manager/kpowersave to do power management. It's great to finally have an unified power management framework, but I'm still not really statisfied with it.

Why? Because I'm not really a desktop-friend, I don't use neither KDE nor Gnome, and I don't use much applets. So, gnome-power-manager and kpowersave are not good options to me.

Furthermore, the ACPI button events are not passed from acpid to HAL, so that these desktop applications can receive. I have to drop the /etc/acpi/events files that used to catch them, or else the events will be handled inconsistently in many ways. So, now, when not in KDE/Gnome, nothing handles these ACPI events anymore, great...

A year ago, the idea of a PolicyManager daemon has been raised, but there has been no implementation for a long time.

It turned out in to PolicyKit and ConsoleKit which will soon be used in a better gnome-power-manager. Though, there is no full integration with power managers yet.

After a discussion between power management application maintainers, an org.freedesktop.Policy.Power interface has been introduced by Novell in kpowersave and powersave. Acquiring this D-Bus interface acts as a lock between power management programs that supports it, so that only one power management policy can get applied. They even patched gnome-power-manager to support this interface.

In Mandriva, to make the events handled when not in KDE/Gnome, I will create a small pm-has-power-policy helper using dbus-send:

dbus-send --system --dest=org.freedesktop.DBus --type=method_call
    --print-reply --reply-timeout=200 / org.freedesktop.DBus.NameHasOwner
 | grep -q 'boolean true'

Then, I have restored /etc/acpi/events helpers, that check if pm-has-power-policy returns false because calling the real actions (poweroff/suspend). Of course, I also have to create a /etc/dbus-1/system.d/policy-power.conf file, to allow user apps to acquire org.freedesktop.Policy.Power.

Finally, I got a simple solution, but the thing is, latest official kpowersave release does not event support poweroff/suspend/hibernate buttons /o\ Yet some more patches to bakport (from kpowersave SVN).

It looks like the better compromise to me as of today, even if the situation will probably evolve quite fast.

Well, what a ride...

Comments are closed for this story.

Trackbacks are closed for this story.

blosxom Optimised for standards.
Olivier Blin (2005)