[gpm] Common system interface for PowerManagement



Hi,

Gnome-power-manager's and kpowersave's job as a policy decision maker is
good, but it's only valuable when X is running. So a system level daemon
which acts as a policy client before X comes up and which is started at a
very early stage in the boot process needs to know when another client,
such as gnome-power-manager, takes over the policy part or exits.

I'm currently facing this proplem with powersaved, which has to start up
very early, but has to ignore some features like CPUFreq as soon as
another client like gnome-power-manager or kpowersave start up. So I'm
looking for a common solution all might agree on...

Therefore I propose a common interface on the system bus policy decision
makers 'grab' with different priority.

It works as follows:

  1. System boots
  2. System level daemon like powersaved starts up and grabs an interface
     org.freedesktop.PowerManager (or similar) on the system bus with low
     priority and the D-Bus flag DBUS_NAME_FLAG_ALLOW_REPLACEMENT
	      
     Something like:
 
     dbus_bus_request_name(system_connection, "org.freedesktop.PowerManager",
	                   DBUS_NAME_FLAG_ALLOW_REPLACEMENT, &dbus_error);

  3. X starts up, a user logs in (or even in gdm) and gnome-power-manager
     is started. g-p-m requests this name on the system bus with high priority:

     Something like:

     dbus_bus_request_name(system_connection, "org.freedesktop.PowerManager",
	                   DBUS_NAME_FLAG_REPLACE_EXISTING, &dbus_error);

  4. The system level daemon automatically releases the interface, gets
     queued on it and from now on knows that there is another client, and
     doesn't care about CPUFreq, etc. anymore.

  5. As soon as g-p-m exits, segfaults ;-), X shuts down or whatever, the
     system level daemon automatically regrabs that interface and
     therefore can care about CPUFreq and stuff until the client restarts
     or another client starts up.

This behaviour would actually mean a oneliner in g-p-m to request the
system interface. It even doesn't have to care about the return
value. This would save me a lot of problems and patches ;-)

What do you think?

Thanks,
	Holger



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]