PowerManager Methods
David Zeuthen
davidz at redhat.com
Tue Jul 26 08:34:55 PDT 2005
On Sun, 2005-07-24 at 21:20 +0100, Richard Hughes wrote:
> Okay, how do we approach the problem of acpi/pmu/apm specific scripts in
> HAL?
>
I think I said it before but I'll say it again - we'll leave that to the
distros to sort out :-) - I'd love to have distros/vendors (Red Hat,
SUSE, Ubuntu, Debian, Gentoo etc.) rally around a common format but I
don't see that happening anytime soon. I've heard though that Ubuntu got
some good power management scripts :-). But see below too.
> Two ways I see as feasible:
>
> 1. A script that is passed the acpi/apm/pmu information as part of it's
> command line (i.e. a multipurpose script)
> The FDI would match the different hibernate/suspend/restart methods with
> the power_management.can_hibernate keys (that are created in
> acpi.c/apm.c/pmu.c)
>
> 2. Multiple scripts for each platform such as acpi-hibernate.sh that
> actually perform the action.
> This would mean we would potentially have 12 different scripts, but the
> scripts could be kept very small.
>
> Assuming we have the key power_management.can_hibernate, where would it
> be set? From an FDI file or from acpi.c itself.
>
> For testing I've been testing the presence of
> power_management.is_enabled and unconditionally adding the keys (so a
> user would modify the FDI file manually)
>
> Doing it in the apm.c type files would allow us to be more selective on
> what each subsystem is capable of.
>
> How should we do this?
I think the first thing to agree upon is the interface exported by HAL.
This will be the abstract vendor/distro neutral interface that desktop
apps, like gnome-power-manager, can rely on. What do we want this
interface to look like?
Here's an idea (in pseudo-code)
interface org.freedesktop.Hal.Device.SystemPowerManagement {
# Suspends the entire system. Puts the system in a state where
# the session is kept in memory at a low power consumption
# rate.
#
# @param wakeUpTime number of seconds before the system wakes up
# or 0 to not automatically wake up
#
# @raises WakeupNotSupported, OperationFailed,
# NotSupported
#
void Suspend(int wakeUpTime);
# Hibernates the entire system. Puts the system in a state where
# the session is stored on persistent media and the system can
# be completely powered off.
#
# @param wakeUpTime number of seconds before the system wakes up
# or 0 to not automatically wake up
#
# @raises WakeupNotSupported, OperationFailed,
# NotSupported
#
void Hibernate(int wakeUpTime);
# This method is used to configure the operating system kernel
# to sacrifice performance, and to a certain extent, data
# integrity, in order to preserve power. It's useful to invoke
# this method when the system transitions from running on AC
# power to battery power and vice verca.
#
# @param lowPowerMode Whether to put the system in low power
# mode
#
# @raises OperationFailed, NotSupported
#
void SetLowPowerMode(bool lowPowerMode);
};
Also, we should have the following properties
system_power_management.supports_suspend (bool)
system_power_management.supports_hibernate (bool)
system_power_management.supports_low_power_mode (bool)
so e.g. gnome-power-manager knows, a'priori, what is supported. We might
want a callout to set these values.
Once we agree on the interface we can talk about how to implement it; if
you want to do a wrapper [1] for the various distros out there and put
that in hal, fine by me :-)
(yea, I know that we already have policy.acpi.linux.can_suspend etc. but
I want to change the names so they match with the interface)
Btw I really really want this interface, and others, to be described in
the spec document
http://cvs.freedesktop.org/*checkout*/hal/hal/doc/spec/hal-spec.html
here; patches always welcome for updating this document from 0.4.x to
0.5.x - right now it's sort of inbetween =).
What do you think?
Cheers,
David
[1] : e.g. pm-suspend on Fedora; other commands on other distros etc.
_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal
More information about the Hal
mailing list