After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 710344 - Remaining time incorrect on dual battery system
Remaining time incorrect on dual battery system
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: power
3.10.x
Other Linux
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2013-10-17 00:33 UTC by Jesse Jaara
Modified: 2015-07-10 15:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
upower -d output (2.14 KB, text/plain)
2013-10-17 20:57 UTC, Jesse Jaara
  Details
upower -d output, v0.9.23 (2.04 KB, text/x-log)
2013-10-18 19:48 UTC, Jesse Jaara
  Details
power: Fix time to empty with multiple batteries (2.28 KB, patch)
2013-10-20 11:32 UTC, Bastien Nocera
committed Details | Review

Description Jesse Jaara 2013-10-17 00:33:51 UTC
On my dual battery laptop (Sony Vaio Pro 13) the reported remaining run-time equals the remaining run-time of battery #1. The percentage of remaining battery power is correct sum of battery #1 and battery #2. This problem exist at least when the battery state is queried with GetPrimaryDevice over dbus.

This results in a severe problem, triggering of the critical power level event, when the #1 battery gets empty, even thought the #2 is still full. Shell's ?usermenu? also reports remaining battery time incorrectly.

This problem did not exist in 3.8 branch.
Comment 1 Bastien Nocera 2013-10-17 15:50:40 UTC
What's the output of "upower -d" on this system?
Comment 2 Jesse Jaara 2013-10-17 20:57:47 UTC
Created attachment 257602 [details]
upower -d output
Comment 3 Bastien Nocera 2013-10-17 22:28:04 UTC
When the problem happens is better though.
Comment 4 Bastien Nocera 2013-10-17 22:29:14 UTC
Oh, and UPower 0.9.22 is broken, and a corrected version still isn't available (git 0.9 branch if you're into compiling your own software). You'll have to wait a bit to test this properly.
Comment 5 Bastien Nocera 2013-10-18 15:56:59 UTC
Please check with UPower 0.9.23, just released.
Comment 6 Jesse Jaara 2013-10-18 17:05:09 UTC
After updating to UPower 0.9.23 the problem persists. On additional note sometimes (Don't know what triggers it) the remaining time gets ridiculously high like 18h or 20h. Control center reports reaming time correctly on the power menu.
Comment 7 Bastien Nocera 2013-10-18 17:16:12 UTC
Can you attach the output of "upower -d" with UPower 0.9.23 when the problem happens?
Comment 8 Jesse Jaara 2013-10-18 19:48:14 UTC
Created attachment 257662 [details]
upower -d output, v0.9.23

This is what 0.9.23 reports.
Comment 9 Bastien Nocera 2013-10-20 11:29:41 UTC
This is what's causing problems:
Device: /org/freedesktop/UPower/devices/battery_BAT0
<snip>
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
<snip>
    energy-rate:         0 W

Because the energy-rate is 0, it wouldn't have a time-to-empty at all. And the composite battery code in gnome-settings-daemon wasn't taking that into account.
Comment 10 Bastien Nocera 2013-10-20 11:32:16 UTC
Created attachment 257745 [details] [review]
power: Fix time to empty with multiple batteries

If one battery is draining and the other one isn't, the time
to empty wouldn't be zero, but it would only match the time
to empty for the single battery.

Instead, short-circuit the time_to_empty re-calculation for
single battery systems, and ignore the accumulated time to
empty/time to full for multiple batteries and recalculate it.
Comment 11 Bastien Nocera 2013-10-20 11:33:16 UTC
Can you please test this patch? I've also push a similar patch for UPower 0.99, as the "composite device" calculations lives there now.
Comment 12 Jesse Jaara 2013-10-20 14:12:37 UTC
This patch does fix the problem indeed.
Comment 13 Bastien Nocera 2013-10-28 16:38:44 UTC
In the future, please don't close bugs as fixed if they have uncommitted patches in them.