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 701993 - Wrong battery indicator when fully charged (99% instead of 100%)
Wrong battery indicator when fully charged (99% instead of 100%)
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Power
3.8.x
Other Linux
: Normal normal
: ---
Assigned To: Richard Hughes
Control-Center Maintainers
3.10
Depends on:
Blocks:
 
 
Reported: 2013-06-11 09:12 UTC by Marie.KOWALCZYK
Modified: 2014-01-21 11:44 UTC
See Also:
GNOME target: ---
GNOME version: 3.7/3.8


Attachments
Screenshot (41.36 KB, image/png)
2013-06-11 09:12 UTC, Marie.KOWALCZYK
  Details
proposed patch (1020 bytes, patch)
2014-01-20 18:46 UTC, Jonh Wendell
needs-work Details | Review
proposed patch, v2 (999 bytes, patch)
2014-01-21 11:25 UTC, Jonh Wendell
committed Details | Review

Description Marie.KOWALCZYK 2013-06-11 09:12:47 UTC
Created attachment 246490 [details]
Screenshot

Steps to reproduce:
1. Plug in power cord and wait to fully charge
2. Go to System Settings and select Power

Expected result:
Battery indicatior should indicate 100%

Actual result:
Battery indicatior indicates 99%

Notes: 
- This is not 100% reproducible.
- After restart, the indicator still shows 99% instead of 100%
Comment 1 Marie.KOWALCZYK 2013-06-11 09:35:44 UTC
Additional info:
See on lenovo X230 Tablet, fedora 19 and Gnome version 3.8.2
Comment 2 Bastien Nocera 2013-06-11 09:50:55 UTC
What's the output of "upower -d" on this machine?
Comment 3 Marie.KOWALCZYK 2013-06-11 10:19:54 UTC
This is the output of "upower -d" on my machine:


Device: /org/freedesktop/UPower/devices/line_power_AC 
  native-path:          /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:08/PNP0C09:00/ACPI0003:00/power_supply/AC 
  power supply:         yes 
  updated:              Tue Jun 11 04:00:29 2013 (8035 seconds ago) 
  has history:          no 
  has statistics:       no 
  line-power 
    online:             yes 

Device: /org/freedesktop/UPower/devices/battery_BAT0 
  native-path:          /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:08/PNP0C09:00/PNP0C0A:00/power_supply/BAT0 
  vendor:               LGC 
  model:                45N1079 
  serial:               8340 
  power supply:         yes 
  updated:              Tue Jun 11 06:14:06 2013 (18 seconds ago) 
  has history:          yes 
  has statistics:       yes 
  battery 
    present:             yes 
    rechargeable:        yes 
    state:               fully-charged 
    energy:              64.3 Wh 
    energy-empty:        0 Wh 
    energy-full:         64.8 Wh 
    energy-full-design:  62.16 Wh 
    energy-rate:         0 W 
    voltage:             12.723 V 
    percentage:          99.2284% 
    capacity:            100% 
    technology:          lithium-ion 

Daemon: 
  daemon-version:  0.9.20 
  can-suspend:     yes 
  can-hibernate:   yes 
  on-battery:      no 
  on-low-battery:  no 
  lid-is-closed:   no 
  lid-is-present:  yes 
  is-docked:       no
Comment 4 Richard Hughes 2013-07-16 16:37:16 UTC
I'm not sure what to do here. The battery has stopped charging slightly before 100% and marked itself as fully charged. We could just force 100% to be in the UI in that case, although that would be a lie.
Comment 5 Bastien Nocera 2013-07-25 09:15:28 UTC
It would also reflect expectations better. If it says "fully-charged" and we're within 1% of 100%, we can show "100%" and stop stressing the user out.
Comment 6 Jonh Wendell 2014-01-20 18:46:25 UTC
Created attachment 266790 [details] [review]
proposed patch
Comment 7 Bastien Nocera 2014-01-21 06:47:07 UTC
Review of attachment 266790 [details] [review]:

::: panels/power/cc-power-panel.c
@@ +315,3 @@
     time = time_full;
 
+  /* Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=701993

I'd rather have a full explanation rather than a bug link, the bug link already is in the commit log.

@@ +318,3 @@
+     If the reported status is fully charged and battery is at 99%,
+     just show 100% */
+  if (state == UP_DEVICE_STATE_FULLY_CHARGED && (100.0 - percentage <= 1))

100.0 is a float, percentage is a float, 1 is an int.
Comment 8 Jonh Wendell 2014-01-21 11:25:17 UTC
Created attachment 266849 [details] [review]
proposed patch, v2
Comment 9 Bastien Nocera 2014-01-21 11:38:30 UTC
Review of attachment 266849 [details] [review]:

Looks good for master and gnome-3-10
Comment 10 Jonh Wendell 2014-01-21 11:44:09 UTC
thanks, pushed to both branches.