Reports 0% charged for fully charged batteries

Bug #1240673 reported by Scott Kitterman on 2013-10-16
96
This bug affects 23 people
Affects Status Importance Assigned to Milestone
upower (Ubuntu)
High
Martin Pitt
Saucy
High
Unassigned
Trusty
High
Martin Pitt

Bug Description

SRU INFORMATION:
Explanation: This bug was introduced with http://cgit.freedesktop.org/upower/commit/?id=07b95b8e which preferred the kernel's reported percentage ("capacity" sysfs attribute") over calculating it from energy/charge. This exposed some buggy batteries/drivers which sometimes report > 100% charge. As the GObject "percentage" property is defined to be between 0 and 100, trying to set a value > 100% resulted in a warning and defaulting to 0%.

Fix: http://cgit.freedesktop.org/upower/commit/?id=22da1a0bc ; this clamping already happens at several other points in the code.

Regression potential: Very low. The code change only applies to the explicit cases of < 0% and > 100%, and these values could have never actually appeared in practice as setting the property to these values fails. It has a test case, and the other test cases prove that this change did not break other configurations. In the worst case (compiler bugs etc.) this update could cause currently working battery information to be wrong, but upower is mostly an informational service these days and thus won't have the ability to completely break the system.

ORIGINAL BUG:

See the following upower dump:

$ upower --dump
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path: AC
  power supply: yes
  updated: Wed 16 Oct 2013 12:58:28 PM EDT (7198 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 Y61CV22
  serial: 3840
  power supply: yes
  updated: Wed 16 Oct 2013 12:58:33 PM EDT (7193 seconds ago)
  has history: yes
  has statistics: yes
  battery
    present: yes
    rechargeable: yes
    state: fully-charged
    energy: 66.6 Wh
    energy-empty: 0 Wh
    energy-full: 66.6 Wh
    energy-full-design: 66.6 Wh
    energy-rate: 0.0111 W
    voltage: 12.836 V
    percentage: 0%
    capacity: 76.9167%
    technology: lithium-ion

Device: /org/freedesktop/UPower/devices/battery_BAT2
  native-path: BAT2
  vendor: Samsung SDI
  model: DELL W1GGM26
  serial: 12515
  power supply: yes
  updated: Wed 16 Oct 2013 12:58:33 PM EDT (7193 seconds ago)
  has history: yes
  has statistics: yes
  battery
    present: yes
    rechargeable: yes
    state: fully-charged
    energy: 31.08 Wh
    energy-empty: 0 Wh
    energy-full: 31.08 Wh
    energy-full-design: 31.08 Wh
    energy-rate: 0.0111 W
    voltage: 12.428 V
    percentage: 0%
    capacity: 81.2857%
    technology: lithium-ion

Note that state is fully-charged, but percentage is o% on both batteries. This worked fine on 13.04.
Daemon:
  daemon-version: 0.9.22
  can-suspend: yes
  can-hibernate: no
  on-battery: no
  on-low-battery: no
  lid-is-closed: no
  lid-is-present: yes
  is-docked: no

ProblemType: Bug
DistroRelease: Ubuntu 13.10
Package: upower 0.9.22-1ubuntu1
ProcVersionSignature: Ubuntu 3.11.0-12.19-generic 3.11.3
Uname: Linux 3.11.0-12-generic i686
ApportVersion: 2.12.5-0ubuntu2
Architecture: i386
Date: Wed Oct 16 15:02:33 2013
EcryptfsInUse: Yes
InstallationDate: Installed on 2011-04-04 (925 days ago)
InstallationMedia: Kubuntu 11.04 "Natty Narwhal" - Beta i386 (20110330)
MarkForUpload: True
SourcePackage: upower
UpgradeStatus: Upgraded to saucy on 2013-10-16 (0 days ago)

Scott Kitterman (kitterman) wrote :
tags: added: regression-release
Ubuntu QA Website (ubuntuqa) wrote :

This bug has been reported on the Ubuntu ISO testing tracker.

A list of all reports related to this bug can be found here:
http://iso.qa.ubuntu.com/qatracker/reports/bugs/1240673

tags: added: iso-testing
Scott Kitterman (kitterman) wrote :

After unplugging it and plugging it back in, it's now reporting correct information for one battery:

$ upower --dump
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path: AC
  power supply: yes
  updated: Thu 17 Oct 2013 09:51:58 AM EDT (496 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 Y61CV22
  serial: 3840
  power supply: yes
  updated: Thu 17 Oct 2013 10:00:04 AM EDT (10 seconds ago)
  has history: yes
  has statistics: yes
  battery
    present: yes
    rechargeable: yes
    state: charging
    energy: 26.8176 Wh
    energy-empty: 0 Wh
    energy-full: 66.6 Wh
    energy-full-design: 66.6 Wh
    energy-rate: 28.3938 W
    voltage: 12.234 V
    time to full: 1.4 hours
    percentage: 52%
    capacity: 76.9167%
    technology: lithium-ion
  History (charge):
    1382018404 52.000 charging
    1382018344 51.000 charging
  History (rate):
    1382018404 28.394 charging
    1382018374 33.644 charging
    1382018344 35.009 charging
    1382018314 34.399 charging

Device: /org/freedesktop/UPower/devices/battery_BAT2
  native-path: BAT2
  vendor: Samsung SDI
  model: DELL W1GGM26
  serial: 12515
  power supply: yes
  updated: Thu 17 Oct 2013 09:52:04 AM EDT (490 seconds ago)
  has history: yes
  has statistics: yes
  battery
    present: yes
    rechargeable: yes
    state: fully-charged
    energy: 31.08 Wh
    energy-empty: 0 Wh
    energy-full: 31.08 Wh
    energy-full-design: 31.08 Wh
    energy-rate: 0.0111 W
    voltage: 12.418 V
    percentage: 0%
    capacity: 81.2857%
    technology: lithium-ion

Daemon:
  daemon-version: 0.9.22
  can-suspend: yes
  can-hibernate: no
  on-battery: no
  on-low-battery: no
  lid-is-closed: no
  lid-is-present: yes
  is-docked: no

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in upower (Ubuntu):
status: New → Confirmed
tags: added: kubuntu
George (geoaraujo) wrote :

Confirmed on Dell N5010

Scott Kitterman (kitterman) wrote :

Now it's back to 0% on both batteries after just a suspend/resume (it was plugged into power when suspended and when resumed, although it had been unplugged while suspended):

$ upower --dump
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path: AC
  power supply: yes
  updated: Fri 18 Oct 2013 02:22:27 PM EDT (7675 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 Y61CV22
  serial: 3840
  power supply: yes
  updated: Fri 18 Oct 2013 04:30:03 PM EDT (19 seconds ago)
  has history: yes
  has statistics: yes
  battery
    present: yes
    rechargeable: yes
    state: fully-charged
    energy: 66.6 Wh
    energy-empty: 0 Wh
    energy-full: 66.6 Wh
    energy-full-design: 66.6 Wh
    energy-rate: 0.0111 W
    voltage: 12.885 V
    percentage: 0%
    capacity: 76.9167%
    technology: lithium-ion
  History (charge):
    1382128199 0.000 unknown
  History (rate):
    1382128199 0.011 fully-charged
    1382128199 0.000 unknown

Device: /org/freedesktop/UPower/devices/battery_BAT2
  native-path: BAT2
  vendor: Samsung SDI
  model: DELL W1GGM26
  serial: 12515
  power supply: yes
  updated: Fri 18 Oct 2013 04:30:03 PM EDT (19 seconds ago)
  has history: yes
  has statistics: yes
  battery
    present: yes
    rechargeable: yes
    state: fully-charged
    energy: 31.08 Wh
    energy-empty: 0 Wh
    energy-full: 31.08 Wh
    energy-full-design: 31.08 Wh
    energy-rate: 0.0111 W
    voltage: 12.404 V
    percentage: 0%
    capacity: 81.2857%
    technology: lithium-ion
  History (charge):
    1382128199 0.000 unknown
  History (rate):
    1382128199 0.011 fully-charged
    1382128199 0.000 unknown

Daemon:
  daemon-version: 0.9.22
  can-suspend: yes
  can-hibernate: no
  on-battery: no
  on-low-battery: no
  lid-is-closed: no
  lid-is-present: yes
  is-docked: no

Changed in upower (Ubuntu):
importance: Undecided → High

Same problems on a Dell Latitude E6520 with a 100Wh battery
  vendor: Samsung SDI
  model: DELL V57XN23

It seems that although state is "fully-charged" the percentage is 0% instead of 100%.
This is what the KDE applet reports most probably so it seems to be a upower bug.

costavi (costavi) wrote :

I have the same problem with mye Dell Latitude E5530, as reported on this (duplicate) bug report:
https://bugs.launchpad.net/ubuntu/+source/kde-baseapps/+bug/1235633

Xarafaxz (xarafaxz) wrote :

Dell Latitude E6430 affected too.

Same problem:
        Manufacturer: Dell Inc.
        Product Name: Latitude E6520
        Version: 01

upower -i /org/freedesktop/UPower/devices/battery_BAT0
  native-path: BAT0
  vendor: SMP
  model: DELL 5G67C21
  serial: 278
  power supply: yes
  updated: Mo 21 Okt 2013 16:14:17 CEST (844 seconds ago)
  has history: yes
  has statistics: yes
  battery
    present: yes
    rechargeable: yes
    state: fully-charged
    energy: 59,9955 Wh
    energy-empty: 0 Wh
    energy-full: 59,9955 Wh
    energy-full-design: 59,9955 Wh
    energy-rate: 0,0111 W
    voltage: 12,76 V
    percentage: 0%
    capacity: 79,0564%
    technology: lithium-ion

Martin Pitt (pitti) wrote :

Sounds like fallout from http://cgit.freedesktop.org/upower/commit/?id=07b95b8e or some similar changes. So this is an inverse kernel/hardware bug to the problem of phone batteries from that commit. *sigh* So we need to add some more heuristics for this case, too.

I have a pretty good idea what happens, but for avoiding mistakes and also to add a reliable test case, can you please copy&paste the output of "grep -r . /sys/class/power_supply/*"?

Changed in upower (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
Scott Kitterman (kitterman) wrote :

Attached grep -r . /sys/class/power_supply/* from a Dell Latitude E6320

Martin Pitt (pitti) wrote :

These are indeed odd, I guess that's what is upsetting upower:

/sys/class/power_supply/BAT0/charge_now:6000000
/sys/class/power_supply/BAT0/charge_full:4615000
/sys/class/power_supply/BAT0/capacity:130

/sys/class/power_supply/BAT2/charge_now:2800000
/sys/class/power_supply/BAT2/charge_full:2276000
/sys/class/power_supply/BAT2/capacity:123

Martin Pitt (pitti) wrote :

Reproduced in test suite:

TI:09:55:58 energy 132,000000 bigger than full 120,000000

(lt-upowerd:8664): GLib-GObject-WARNING **: value "110,000000" of type 'gdouble' is invalid or out of range for property 'percentage' of type 'gdouble'

That's how it ends up as 0%.

Changed in upower (Ubuntu):
status: Confirmed → In Progress
Martin Pitt (pitti) wrote :

Fixed upstream with a test case: http://cgit.freedesktop.org/upower/commit/?id=22da1a0bc
Also cherry-picked into 0.9 branch.

Changed in upower (Ubuntu):
status: In Progress → Fix Committed

On Tuesday, October 22, 2013 08:07:54 you wrote:
> Fixed upstream with a test case:
> http://cgit.freedesktop.org/upower/commit/?id=22da1a0bc Also cherry-picked
> into 0.9 branch.

I rebuilt the package locally with the patch and that (not surprisingly)
solved the problem. I think this should, in addition to being fixed in trusty,
be an SRU for saucy.

Thanks.

Martin Pitt (pitti) wrote :

I backported the patch and uploaded it to Debian. Will sync it as soon as it gets imported.

Martin Pitt (pitti) wrote :

Saucy SRU uploaded.

description: updated
Changed in upower (Ubuntu Saucy):
status: New → In Progress

Hello Scott, or anyone else affected,

Accepted into saucy-proposed. The package will build now and be available in a few hours in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in upower (Ubuntu Saucy):
status: In Progress → Fix Committed
tags: added: verification-needed
Changed in upower (Ubuntu Saucy):
importance: Undecided → High
Changed in upower (Ubuntu Trusty):
status: Fix Committed → Fix Released
status: Fix Released → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package upower - 0.9.23-2

---------------
upower (0.9.23-2) unstable; urgency=low

  * Drop hardcoded binary glib dependency, it's already being generated
    automatically from the versioned build depends.
  * Add 00git_clamp_percentage.patch: Clamp percentage for overfull batteries,
    to avoid showing 0% on some fully charged battery models. Fixes regression
    from 0.9.22. (LP: #1240673)

 -- Martin Pitt <email address hidden> Wed, 23 Oct 2013 08:31:44 +0200

Changed in upower (Ubuntu Trusty):
status: Fix Committed → Fix Released
Scott Kitterman (kitterman) wrote :

Installed the updated package and it now works as expected.

tags: added: verification-done
removed: verification-needed
costavi (costavi) wrote :

I would like to test the new package, but

is the fixed pachage already available in the 'proposed' repository? Because, once added the 'proposed' repository I receive the following update proposals:

glib-networking glib-networking-common glib-networking-services kubuntu-docs libglib2.0-0
  libglib2.0-0:i386 libglib2.0-bin libglib2.0-data libindicator3-7 plasma-nm
  plasma-widget-networkmanagement python3-software-properties software-properties-common
  software-properties-kde

I don't see a 'upower' package. Besides, should I cast a 'sudo apt-get upgrade' or just a 'sudo apt-get install upower'?

costavi [2013-10-23 15:20 -0000]:
> is the fixed pachage already available in the 'proposed' repository?

Yes, it is:

    upower | 0.9.22-1ubuntu1 | saucy | source, amd64, arm64, armhf, i386, powerpc
    upower | 0.9.22-1ubuntu2 | saucy-proposed | source, amd64, arm64, armhf, i386, powerpc

> I don't see a 'upower' package.

It might be that your mirror is slightly behind?

> Besides, should I cast a 'sudo apt-get > upgrade' or just a 'sudo apt-get
> install upower'?

The latter is enough to verify only this bug.

costavi (costavi) wrote :

Ok, I installed the new upower package, and it works on my Dell Latitude E5530, now the battery applet shows 100% on full charge.

Here is the output of:

upower --dump

Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path: AC
  power supply: yes
  updated: mer 23 ott 2013 21:17:09 CEST (117 seconds ago)
  has history: no
  has statistics: no
  line-power
    online: yes

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path: BAT0
  vendor: Sanyo
  model: DELL NH6K933
  serial: 1108
  power supply: yes
  updated: mer 23 ott 2013 21:17:15 CEST (111 seconds ago)
  has history: yes
  has statistics: yes
  battery
    present: yes
    rechargeable: yes
    state: fully-charged
    energy: 62,16 Wh
    energy-empty: 0 Wh
    energy-full: 62,16 Wh
    energy-full-design: 62,16 Wh
    energy-rate: 0,0111 W
    voltage: 12,431 V
    percentage: 100%
    capacity: 87,8036%
    technology: lithium-ion

Daemon:
  daemon-version: 0.9.22
  can-suspend: yes
  can-hibernate: no
  on-battery: no
  on-low-battery: no
  lid-is-closed: no
  lid-is-present: yes
  is-docked: no

George (geoaraujo) wrote :

Fixed on Dell N5010.
Thank you.

Fixed on Dell Latitude E6520
Thank you.

Hervé Fache (rvfh) wrote :

I installed http://ru.archive.ubuntu.com/ubuntu/pool/main/u/upower/upower_0.9.23-2_amd64.deb and in a few seconds my battery went from empty to fully charged. The shortest charging time ever ;-)

Dell Latitude E6530

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package upower - 0.9.22-1ubuntu2

---------------
upower (0.9.22-1ubuntu2) saucy-proposed; urgency=low

  * Add 00git_clamp_percentage.patch: Clamp percentage for overfull batteries,
    to avoid showing 0% on some fully charged battery models. Fixes regression
    from 0.9.22. (LP: #1240673)
 -- Martin Pitt <email address hidden> Wed, 23 Oct 2013 08:41:01 +0200

Changed in upower (Ubuntu Saucy):
status: Fix Committed → Fix Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Hi!
I have same problem on my Dell Inspiron 7737 notebook with Ubuntu 14.04.

the output of upower --dump is:

-----------------------------------------------------------------------------------------------------------------------------
corwin@corwin-Inspiron-7737:~$ LANG=C upower --dump
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path: AC
  power supply: yes
  updated: Fri May 9 14:41:51 2014 (553 seconds ago)
  has history: no
  has statistics: no
  line-power
    online: no

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

After I unplug/plug power supply the output of upower --dump is:

-------------------------------------------------------------------------
corwin@corwin-Inspiron-7737:~$ LANG=C upower --dump
Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path: AC
  power supply: yes
  updated: Fri May 9 14:51:28 2014 (8 seconds ago)
  has history: no
  has statistics: no
  line-power
    online: yes

Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path: BAT0
  vendor: SANYO
  model: DELL Y1FGD41
  serial: 1001
  power supply: yes
  updated: Fri May 9 14:51:32 2014 (4 seconds ago)
  has history: yes
  has statistics: yes
  battery
    present: yes
    rechargeable: yes
    state: fully-charged
    energy: 60.192 Wh
    energy-empty: 0 Wh
    energy-full: 60.192 Wh
    energy-full-design: 60.192 Wh
    energy-rate: 0.0144 W
    voltage: 16.541 V
    percentage: 100%
    capacity: 100%
    technology: lithium-ion
  History (charge):
    1399632689 100.000 fully-charged
    1399632686 97.000 discharging
    1399632686 0.000 unknown
  History (rate):
    1399632689 0.014 fully-charged
    1399632687 17.424 discharging
    1399632686 0.014 discharging
    1399632686 0.000 unknown

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

Note for my last comment:

The system detects battery without any problems and battery indicator works fine in KDE when I boot from Kubuntu 14.04 installation DVD. The battery indicator works fine after I install Kubuntu 14.04 to hard disk, but stop work after I did 'dist-upgrade' on installed system.

I hope this info helps to fix the bug.

Another note:
The issue appears when I activate nvidia driver - nvidia-331.

atterdag (valdemar-lemche) wrote :

I have the same finding as Sergey, and I'm tried both the nvidia driver from nvidia-311, and nvidia-311-updates

$ upower --dump
Device: /org/freedesktop/UPower/devices/battery_BAT0
  native-path: BAT0
  vendor: Panasonic
  model: 42T4801
  serial: 1495
  power supply: yes
  updated: fre 27 jun 2014 08:59:18 (5 seconds ago)
  has history: yes
  has statistics: yes
  battery
    present: yes
    rechargeable: yes
    state: charging
    energy: 78,43 Wh
    energy-empty: 0 Wh
    energy-full: 81,17 Wh
    energy-full-design: 84,24 Wh
    energy-rate: 11,605 W
    voltage: 12,268 V
    time to full: 14,1 minutes
    percentage: 96%
    capacity: 96,3557%
    technology: lithium-ion
  History (rate):
    1403852358 11,605 charging
    1403852328 12,460 charging
    1403852298 12,456 charging
    1403852268 12,672 charging

Device: /org/freedesktop/UPower/devices/line_power_AC
  native-path: AC
  power supply: yes
  updated: fre 27 jun 2014 08:41:42 (1061 seconds ago)
  has history: no
  has statistics: no
  line-power
    online: yes

Device: /org/freedesktop/UPower/devices/mouse_hid_00o02o76o34oafoe3_battery
  native-path: hid-00:02:76:34:af:e3-battery
  model: ThinkPad Bluetooth Laser Mouse
  power supply: no
  updated: fre 27 jun 2014 08:58:55 (28 seconds ago)
  has history: yes
  has statistics: yes
  mouse
    present: yes
    rechargeable: yes
    state: discharging
    percentage: 0%

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

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers