Bug 70952 - On boot and login with ac power battery shows zero percent when it is full
Summary: On boot and login with ac power battery shows zero percent when it is full
Status: RESOLVED FIXED
Alias: None
Product: upower
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Richard Hughes
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-28 11:02 UTC by Mike C
Modified: 2013-10-28 18:38 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Mike C 2013-10-28 11:02:51 UTC
Dell M4300 laptop (and also Samsung Q35 laptop) both show a upower battery output of zero percent when the battery is fully charged, when booted to archlinux fully up to date, with the ac power cord connected.  Yet acpi -b output confirms the battery is fully charged, and the kernel appears also to be correctly reporting the battery state.

Versions are upower 0.9.23-1 (but the same problem occurred with version 0.9.22)

Battery status from the various sources of data are:

[mike@lapmike3 ~]$ cat /sys/class/power_supply/BAT0/charge_now
5200000

[mike@lapmike3 ~]$ acpi -b
Battery 0: Full, 100%

[mike@lapmike3 ~]$ upower -d
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path:          AC
  power supply:         yes
  updated:              Mon 28 Oct 2013 10:46:54 GMT (782 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 XD7368
  serial:               3261
  power supply:         yes
  updated:              Mon 28 Oct 2013 10:46:59 GMT (777 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               fully-charged
    energy:              57.72 Wh
    energy-empty:        0 Wh
    energy-full:         57.72 Wh
    energy-full-design:  57.72 Wh
    energy-rate:         6.0051 W
    voltage:             12.004 V
    percentage:          0%
    capacity:            92.4615%
    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

It is noticed that the "percentage 0%" is not consistent with "state fully-charged" in the upower output.

The symptoms look similar to the report at https://bugs.freedesktop.org/show_bug.cgi?id=49846 which was never resolved.

Also I had previously reported this to the KDE bug reports at https://bugs.kde.org/show_bug.cgi?id=326332
Comment 1 Bastien Nocera 2013-10-28 16:03:38 UTC
What does:
$ cat /sys/class/power_supply/BAT0/capacity
say?
Comment 2 Mike C 2013-10-28 18:06:29 UTC
Here is the output of the requested command plus the parameters in the same directory:

[mike@lapmike3 ~]$ cat /sys/class/power_supply/BAT0/capacity 
108
[mike@lapmike3 ~]$ cat /sys/class/power_supply/BAT0/charge_now
5200000
[mike@lapmike3 ~]$ cat /sys/class/power_supply/BAT0/charge_full
4808000
[mike@lapmike3 ~]$ cat /sys/class/power_supply/BAT0/charge_full_design 
5200000
[mike@lapmike3 ~]$ cat /sys/class/power_supply/BAT0/current_now 
1000
[mike@lapmike3 ~]$ cat /sys/class/power_supply/BAT0/cycle_count 
0

I also see that there is a new version of upower in the repos - so I will update the system and test again shortly.
Comment 3 Bastien Nocera 2013-10-28 18:18:48 UTC
Was fixed by that commit. Will be in the next version of UPower 0.9, and 0.99.

commit b8fe9902f3c6c50ca6a23e24fcea99582beebc65
Author: Martin Pitt <martinpitt@gnome.org>
Date:   Tue Oct 22 10:02:51 2013 +0200

    linux: Clamp percentage for overfull batteries
    
    Some batteries report energy > energy_full and a percentage ("capacity"
    attribute) > 100%. Clamp these within 0 and 100% for both plausibility as well
    as to avoid setting an out-of-range property which would then become 0%.
    
    https://launchpad.net/bugs/1240673
Comment 4 Mike C 2013-10-28 18:38:53 UTC
Many thanks - this is confirmed fixed as of archlinux upower version: upower 0.9.23-2

With this latest version the command outputs from the previous commands are:

[mike@lapmike3 ~]$ cat /sys/class/power_supply/BAT0/capacity 
108
[mike@lapmike3 ~]$ cat /sys/class/power_supply/BAT0/charge_now
5200000
[mike@lapmike3 ~]$ cat /sys/class/power_supply/BAT0/charge_full
4808000
[mike@lapmike3 ~]$ cat /sys/class/power_supply/BAT0/charge_full_design 
5200000
[mike@lapmike3 ~]$ cat /sys/class/power_supply/BAT0/current_now 
1000
[mike@lapmike3 ~]$ cat /sys/class/power_supply/BAT0/cycle_count 
0
[mike@lapmike3 ~]$ acpi -b
Battery 0: Full, 100%
[mike@lapmike3 ~]$ upower -d
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path:          AC
  power supply:         yes
  updated:              Mon 28 Oct 2013 18:19:07 GMT (113 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 XD7368
  serial:               3261
  power supply:         yes
  updated:              Mon 28 Oct 2013 18:19:12 GMT (108 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               fully-charged
    energy:              57.72 Wh
    energy-empty:        0 Wh
    energy-full:         57.72 Wh
    energy-full-design:  57.72 Wh
    energy-rate:         0.0111 W
    voltage:             12.919 V
    percentage:          100%
    capacity:            92.4615%
    technology:          lithium-ion
  History (charge):
    1382984348  100.000 fully-charged
    1382984347  0.000   unknown
  History (rate):
    1382984348  0.011   fully-charged
    1382984347  0.000   unknown

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

Many thanks for the fast resolution.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.