Scenario: I use a toshiba laptop that uses ACPI. In gnome there is no way to easy change the brightness of the display without going to root in a terminal. Also, I can't remove my pcmcia adapter without being root in a terminal window. Both of which the average user would want to do. I can do this simply by clicking icons on the WindowsXP taskbar. Also, when my battery runs low, I get an event in gnome, telling me the time left. If I ignore this message, my machine just powers off, and does not shutdown or suspend. I have an idea that would use DBUS and HAL, much in the way of Project Utopia suggests.
http://mail.gnome.org/archives/utopia-list/2004-May/msg00019.html
A DBUS enabled service called, say, PowerService (with root privs) that could execute the needed commands: #echo "brightness: 3" > /sys/acpi/toshiba/lcd or #cardctl eject or #shutdown -h Depending on the value of a config file.
PowerService could also supply (a modified) battstat with it's information about battery levels and whether it is on mains or battery. An extra applet could be designed to control the brightness of the lcd display, and also an eject applet (only visible if pcmcia card inserted) that would allow me to eject in one click.
PowerService could load a policy when the cable is removed, say for instance to slow the processor and to dim the screen.
I have created an applet that lets me change the brightness for the time being, but the idea of lots of small services for each task, and multiple applets with system-specific options is non-ideal.
Has this been done before? Or is it worth discussion? I thought I would try you guys at f-d-l and then try the gnome people when I know more good ideas/case studies.
Richard Hughes
Hi,
On Fri, 2004-11-12 at 20:41 +0000, Hughes R Mr (UG - Electronic Eng) wrote:
Has this been done before? Or is it worth discussion? I thought I would try you guys at f-d-l and then try the gnome people when I know more good ideas/case studies.
I think a better approach might be to teach hal about ACPI (for x86 and others), PMU (for PowerMac's etc.) and provide an abstraction using the functionality already in hal (e.g. properties on hal device objects and callouts, device information files). This abstraction should be made sufficiently extensible such that it may support more than ACPI and PMU as well as the varying features on different laptops [1].
http://freedesktop.org/pipermail/hal/2004-July/000555.html
Nothing really happened, though. Now that FC3 is out I hope to find some time to do this for FC4 - it shouldn't be too difficult.
An interesting question is how we allow the desktop session to say "put the system into standby". One trivial idea is to provide a 'system- suspend' command (through consolehelper or something), however I think that it might make more sense to make the hal daemon expose a D-BUS interface with the appropriate methods - e.g. perhaps just the method Suspend() on an interface org.freedesktop.Hal.Device.PowerManagement.
This method call should map to an appropriate script. That way we can leverage the D-BUS policy system for allowing/denying this action [2]. Plus, that we'll need this in HAL anyway for other kind hardware/actions (e.g. Rename() and Eject() on storage volumes) and it makes it somewhat easier to use from e.g. GNOME applets.
Cheers, David
[1] : Some laptops doesn't turn off the display when the lid is closed (my Powerbook 12" for instance); tablets PC's probably don't have a lid at all etc.
[2] : which may be as simple as only allowing an authorized user at the console to perform the action.
devel@lists.stg.fedoraproject.org