Re: A battery applet...



On Tue, 2004-12-14 at 09:00 +0800, Davyd Madeley wrote:
> Of course, using HAL directly might not prove to be the right solution either.
> Especially if each HAL request translates into a request to /proc. I'm not sure
> if HAL will hold state for us. Since calls to /proc/acpi are somewhat expensive,
> it might be better to abstract it through PowerManager (the piece of vaporware
> I've been talking about for months) or at least make it modular enough that we
> can do this at a later date.
> 

Well, the plan is that the hal daemon will basically poll /proc/acpi for
ACPI based systems, do the /dev/pmu thing for PMU based systems or
whatever. Over time we also want to add support for USB-HID-based UPS'es
- I just got myself one of those!

We yet have to write this code though, but it's not a lot of code; it's
not really code that will be part of hal proper, in other words it fits
into the architecture as what we will call hal add-ons. This makes it
quite extensible. So, if I'm an open source project (or OEM for that
matter), I can go ahead and contribute code for polling UPS'es with non-
standard protocols. All I need to do is to write out the right hal
properties. I think that is nice.

> It will also be important to receive "battery level has changed" events
> asyncronously, I think HAL will be able to do this though.
> 

Yeah, it's basically just properties on hal device objects changing.
Every time a single property changes in hal you will get a D-BUS signal
(assuming you subscribe to it). It will also be visible from hal-device-
manager.

> This could be implemented very badly, very easily (look at the current applet).
> Basically power management sucks at the moment, and we do need a rich power
> management API.
> 

The problem that I see today is more the configuration and what to do
e.g. when idle based on whether I'm running on AC power or not. 

It seems to me that all this should live in a separate preference
capplet with some daemon enforcing the policy (much like the g-v-m
architecture). That daemon could make sure to add the applet if it got
anything interesting to show [1]. How to factor in xscreensaver I don't
really want to get into :-)

David

[1] : I always hate adding the Battery Applet when diving into a fresh
install of GNOME.




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