Bug 1025980

Summary: fully charged battery reported as 0% charged
Product: [Fedora] Fedora Reporter: Rex Dieter <rdieter>
Component: upowerAssignee: Rex Dieter <rdieter>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: jv+fedora, rhughes
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: upower-0.9.23-2.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-14 03:52:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Rex Dieter 2013-11-02 18:18:46 UTC
cliff's notes version, is upower reports:
    state:               fully-charged
    percentage:          0%

when I boot machine plugged-in and fully charged, full upower -d output below:


$ upower -d
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path:          AC
  power supply:         yes
  updated:              Sat 02 Nov 2013 01:12:55 PM CDT (125 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    online:             yes

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               SMP
  model:                DELL PD6858
  serial:               1842
  power supply:         yes
  updated:              Sat 02 Nov 2013 01:13:00 PM CDT (120 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               fully-charged
    energy:              86.58 Wh
    energy-empty:        0 Wh
    energy-full:         86.58 Wh
    energy-full-design:  86.58 Wh
    energy-rate:         0.0111 W
    voltage:             12.464 V
    percentage:          0%
    capacity:            93.2564%
    technology:          lithium-ion

Daemon:
  daemon-version:  0.9.23
  on-battery:      no
  on-low-battery:  no
  lid-is-closed:   no
  lid-is-present:  yes
  is-docked:       no

Comment 1 Rex Dieter 2013-11-03 03:05:16 UTC
Now unplug from AC wait a bit and percentage jumps up to expected values:

    percentage:          97%

$ upower -d
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path:          AC
  power supply:         yes
  updated:              Sat 02 Nov 2013 10:01:33 PM CDT (154 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    online:             no

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               SMP
  model:                DELL PD6858
  serial:               1842
  power supply:         yes
  updated:              Sat 02 Nov 2013 10:03:39 PM CDT (28 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               discharging
    energy:              78.366 Wh
    energy-empty:        0 Wh
    energy-full:         86.58 Wh
    energy-full-design:  86.58 Wh
    energy-rate:         36.5523 W
    voltage:             12.032 V
    time to empty:       2.1 hours
    percentage:          97%
    capacity:            93.2564%
    technology:          lithium-ion
  History (rate):
    1383447819  36.552  discharging
    1383447789  33.788  discharging
    1383447759  34.177  discharging

Daemon:
  daemon-version:  0.9.23
  on-battery:      yes
  on-low-battery:  no
  lid-is-closed:   no
  lid-is-present:  yes
  is-docked:       no

Comment 2 Rex Dieter 2013-11-21 13:38:26 UTC
reported upstream,
https://bugs.freedesktop.org/show_bug.cgi?id=71874

Comment 3 Rex Dieter 2013-11-21 13:50:09 UTC
This may be relevant:

systemctl status upower:
...

Nov 21 07:48:45 localhost.localdomain upowerd[1656]: (upowerd:1656): UPower-Linux-WARNING **: energy 86.580000 bigger than full 77.899800
Nov 21 07:48:45 localhost.localdomain upowerd[1656]: (upowerd:1656): GLib-GObject-WARNING **: value "111.000000" of type 'gdouble' is invalid or out of range for prop... 'gdouble'

Comment 4 Jan Včelák 2013-12-06 19:39:37 UTC
The same here.

# systemctl status upower
...
Dec 06 19:49:38 hostname upowerd[861]: (upowerd:861): UPower-Linux-WARNING **: energy 93,240000 bigger than full 46,919700
Dec 06 19:49:38 hostname upowerd[861]: (upowerd:861): GLib-GObject-WARNING **: value "198,000000" of type 'gdouble' is invalid or out of range for property 'percentage' of type 'gdouble'
...

# cat /sys/class/power_supply/BAT0/charge_now 
8400000
# cat /sys/class/power_supply/BAT0/charge_full
4227000
# cat /sys/class/power_supply/BAT0/charge_full_design 
8400000

# upower -d                                        
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path:          AC
  power supply:         yes
  updated:              Fri Dec  6 19:49:38 2013 (2972 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    online:             yes

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path:          BAT0
  vendor:               SMP
  model:                DELL HJ59005
  serial:               319
  power supply:         yes
  updated:              Fri Dec  6 19:49:43 2013 (2967 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               fully-charged
    energy:              93.24 Wh
    energy-empty:        0 Wh
    energy-full:         93.24 Wh
    energy-full-design:  93.24 Wh
    energy-rate:         0.0111 W
    voltage:             12.803 V
    percentage:          0%
    capacity:            50.3214%
    technology:          lithium-ion

Daemon:
  daemon-version:  0.9.23
  on-battery:      no
  on-low-battery:  no
  lid-is-closed:   no
  lid-is-present:  yes
  is-docked:       no

Comment 5 Rex Dieter 2013-12-06 20:43:03 UTC
OK, seems fairly clear given these 2 cases, that the code doesnt handle the case where

charge_now > charge_full 

very well (ends up reporting as 0%)

I'll take a look at the code, I'd argue reporting this case as 100% would be more graceful (assuming > 100% is not acceptable either).

Comment 6 Jan Včelák 2013-12-06 21:08:00 UTC
I just noticed that both cases appear with batteries from Dell. So I guess that it is not a coincidence and that the core of the problem is kernel (reboot helps sometimes).

However it would be fine if the userspace code could workaround it. :-)

Comment 7 Rex Dieter 2013-12-08 02:53:01 UTC
Looks like it's fixed upstream already, post 0.9.23, will backport the fix to fedora packaging.

Comment 8 Fedora Update System 2013-12-08 03:16:53 UTC
upower-0.9.23-2.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/upower-0.9.23-2.fc20

Comment 9 Fedora Update System 2013-12-08 17:49:43 UTC
Package upower-0.9.23-2.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing upower-0.9.23-2.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-22973/upower-0.9.23-2.fc20
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2013-12-14 03:52:37 UTC
upower-0.9.23-2.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.