Feature requests for hal battery backend.

Ryan Lortie desrt at desrt.ca
Sat Jul 30 14:32:49 PDT 2005


Le samedi 30 juillet 2005 à 22:19 +0100, Richard Hughes a écrit :
> Okay, what about doing this:
> 
> battery.charge_level.type = {percent|csr|mWh} NOT mAh
> 
> APM / UPS
> battery.charge_level.current = x
> battery.charge_level.percentage = x
> battery.charge_level.last_full = 100
> battery.charge_level.design = 100
> battery.charge_level.type = {percent}
> 
> CSR
> battery.charge_level.current = x
> battery.charge_level.last_full = 7
> battery.charge_level.design = 7
> battery.charge_level.percentage = x/7
> battery.charge_level.type = {csr}
> 
> ACPI / PMU
> battery.charge_level.current = x	/* normalised */
> battery.charge_level.last_full = x	/* normalised */
> battery.charge_level.design = x		/* normalised */
> battery.charge_level.rate = x		/* normalised */
> battery.charge_level.percentage = x
> battery.charge_level.type = {mWh}
> 
> battery.reporting.type = {mWh|mAh|mJ|whatever}
> battery.reporting.current = x		/* mWh|mAh|Odd */
> battery.reporting.last_full = x		/* mWh|mAh|Odd */
> battery.reporting.design = x		/* mWh|mAh|Odd */
> battery.reporting.rate = x		/* mWh|mAh|Odd */
> 
> the reporting fields being the ones got from hardware, and the
> charge_level fields the normalised ones used.
> 
> This way we do not have to add 3 extra keys to every battery object.

I like this a lot more, actually.  Except I think you should stick with
"unit" instead of "type".  I also think that PMU could just be treated
like APM (ie: just report the native units as they are).  At least for
the time being this is definitely safe since Apple doesn't make any
dual-battery laptops.  It's probably safe anyway since Apple probably
uses sane (Joule/mWh type) units.

There's also some added advantages: under this scheme, the APM and PMU
backends don't have to change at all.  Also, the API remains more stable
for clients using it (ie: you don't have to switch from "battery.charge"
to "battery.normalised".. you just keep using "charge" and get the nicer
new behaviour).  This will come in extremely handy due to the fact that
we are so close to GNOME 2.12.

>
> What you both think?

I give it eleven thumbs up.

Cheers.
_______________________________________________
hal mailing list
hal at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/hal



More information about the Hal mailing list