bug to fix mAh -> uWh

Richard Hughes hughsient at gmail.com
Sat Jul 29 11:09:35 PDT 2006


I'm getting more and more people falling for the mAh to uWh bug in HAL
which manifests itself in many odd ways:

http://bugzilla.gnome.org/show_bug.cgi?id=348234
http://bugzilla.gnome.org/show_bug.cgi?id=348998
http://bugzilla.gnome.org/show_bug.cgi?id=338281

Basically, for those not following all the gory details, acpi sends the
rate normally in mWh or sometimes mAh.

We can convert the mAh reading (battery.reporting.rate) into mWh
(battery.charge_level.rate) by multiplying it by the voltage (in Volts),
but in current HAL cvs we are multiplying it by the voltage in mV, and
so the rate information is a factor of 3 too large. This *really* breaks
calculating the time for multibattery laptops, and doing snazzy things
like that.

Note, we can't always convert into mWh for stuff like UPS (so it's not a
standard unit as far as HAL is concerned) but at the moment we are
advertising that we have converted it into mWh and in fact we have
converted it into uWh.

The attached patch has been tested to fix the various issues by no fewer
than 7 people, either on IRC or in person (just at GUADEC this fixed two
people's laptops that I bumped into).

The patch has also been unconditionally compiled into my utopia RPMs for
the last couple of months and I've had no complaints.

Good to commit?

Richard.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hal-fix-uwh-to-mwh.patch
Type: text/x-patch
Size: 2727 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20060729/bbc869e9/hal-fix-uwh-to-mwh.bin


More information about the hal mailing list