[PATCH] fix percentage for empty batteries

Danny Kukawka danny.kukawka at web.de
Wed Jan 2 13:38:54 PST 2008


On Mittwoch, 2. Januar 2008, Richard Hughes wrote:
> > > 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?

Following worst case scenario:

- 2 batteries in the system
- first battery get full emtpy, but get displayed as 100% in HAL due to the 
bug
- second battery get down to empty (and if full empty to 100% as the first 
one, but doesn't matter atm)
- because the first battery report false 100% and the second e.g. correct 2% 
(which would be e.g. the overall remaining level for battery critical in 
KPowersave which would lead depending on the user settings to a shutdown or 
s2disk) you get together 51% remaining battery percentage for both batteries. 
- You never reach in such case a low or critical levels. Both batteries get 
simply full empty and the system go off/crash, because it always reports 
values between 50 and 100 %.

Danny 


More information about the hal mailing list