[PATCH] fix percentage for empty batteries
David Zeuthen
david at fubar.dk
Sun Dec 16 18:01:49 PST 2007
Hey,
On Sun, 2007-12-16 at 15:17 +0100, Danny Kukawka wrote:
> Hi,
>
> with commit d7144f2aa1b59f9a0acfa0daada69e2a4ffd54d8 the handling of empty
> batteries changed, which cause massive problems with multi battery machines.
That's Richard's commit. Richard?
> In the past the battery.charge_level.percentage key was removed if there where
> any problems with calculate the remaining percentage of a battery. This
> include the case where the current charge level was 0, which was/is IMO also
> wrong, since 0 is a correct value for a percentage.
>
> With the current HAL the battery get set in such cases to 100% which cause
> e.g. KPowersave to assume the battery is full and not empty, which also lead
> to wrong overall remaining percentage calculation in multi battery systems,
> which can lead to crash the complete system if both batteries get empty!
>
> The attached patch change the code to remove the key again on problems. IMO we
> should think about change the behavior if the current charge level is really
> 0 to set the percentage also to 0. The userspace tools should be able to
> handle this!
>
> Danny
>
> device_pm.c | 18 +++++++++++-------
> 1 file changed, 11 insertions(+), 7 deletions(-)
> _______________________________________________
> hal mailing list
> hal at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/hal
More information about the hal
mailing list