[PATCH] fix percentage for empty batteries
Danny Kukawka
danny.kukawka at web.de
Sun Dec 16 06:17:02 PST 2007
Hi,
with commit d7144f2aa1b59f9a0acfa0daada69e2a4ffd54d8 the handling of empty
batteries changed, which cause massive problems with multi battery machines.
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(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hal-fix-percentage_on_empty_battery.diff
Type: text/x-diff
Size: 1593 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/hal/attachments/20071216/cb3c8bc3/attachment.diff
More information about the hal
mailing list