Comment 9 for bug 880881

Revision history for this message
Charles Kerr (charlesk) wrote : Re: Power indicator does not combine multiple battery status

Rob, the choice of selecting the mouse battery over the laptop battery in the use case in omeil's comment #3 is by design, since the specification is to choose the battery that will be empty soonest.

However, I believe that's a separate issue from the two-laptop-batteries case reported by Mathieu here and by you in bug #1290623. It makes sense to combine two laptop batteries into a totaled representation; it doesn't make sense to do that for a laptop battery + mouse battery. :)

So, I sat down to code on this yesterday and realized there are still cases where I'm not sure what the Right Thing is.

The spec's revised form says to total together multiple batteries iff "a device has multiple batteries and uses only one of them at a time" but judging from Rob's upower dump yesterday <https://launchpadlibrarian.net/169021213/UPowerDump.txt> another valid use case is two laptop batteries that are both discharging.

My thoughts on it:

* If the laptop has two or more DISCHARGING batteries (Rob's case), we could use an average of their percentages and the maximum of their time-remaining values.

* Otherwise, if the laptop has one DISCHARGING and one or more IDLE batteries (Mathieu's case), we could use an average of their percentages and the sum of time-remaining.

* Otherwise, if the laptop has one CHARGING and one or more IDLE batteries, we could use an average of their percentages and the maximum of the CHARGING time-remaining values.

* Otherwise, if the laptop has both CHARGING and DISCHARGING batteries at the same time... first off, I'm not sure this is a meaningful use case? What icon would we use? :) We could use an average of the batteries' percentages and either not report a time, or use the maximum of the DISCHARGING time-remaining values.

* Otherwise, do not average batteries together in the header.

Punting back to mpt for a second opinion on this. ;)