Re: [ltp] Re: [PATCH v2] Re: Battery class driver.

From: Henrique de Moraes Holschuh
Date: Fri Nov 03 2006 - 07:46:32 EST


On Thu, 02 Nov 2006, Bill Davidsen wrote:
> Having seen a French consultant with a Windows laptop reporting mJ
> (Joules) I bet that came from the hardware. And given that laptop
> batteries run at (almost) constant voltage, could all of these just be
> converted to mWh for consistency?

*No*. That adds quite a lot of error, which can be easily avoided by
providing the _charge and _energy attribute sets.

You can convert between J and Wh and between C to Ah without significant
precision loss. Just don't go cheap on the fixed point calculations, and
make sure the destination unit is small enough not to forsake precision.

We can definately be safe from any precision loss using (10^-6) * (A, Ah, W,
Wh, V) as the base unit, but that will make for long numbers in sysfs with
lots of zeros in many situations (which is MUCH better than precision loss).

We could also use a proper submultiple of J and C instead of Wh and Ah if
we'd rather stick to the SI, that wouldn't be a big problem at all.

--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/