[PATCH] fix percentage for empty batteries

Richard Hughes hughsient at gmail.com
Wed Jan 2 12:09:06 PST 2008


On Sun, 2007-12-16 at 21:01 -0500, David Zeuthen wrote:
> 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

Sorry, this mail got lost in the deluge.

> > 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. 

Hmm, yes, I guess.

> > 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!

How does the crash happen out of interest?

> > 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!

Sure, totally. Patch looks good to me. Sorry about the delay.

Richard.




More information about the hal mailing list