← Back to team overview

debcrafters-packages team mailing list archive

[Bug 2117707] [NEW] More than 100% battery reported with 2+ batteries

 

Public bug reported:

I can reproduce it after a couple of tries on my Dell Rugged 5430
equipped with 2 batteries. My assumption is that may happen on any
hardware with 2+ batteries with plucky and upower 1.90.7-1build1.

Sometimes after resuming from suspend upower reports more than 100%
percentage on the DisplayDevice composite battery:

upower -d /org/freedesktop/UPower/devices/DisplayDevice

Device: /org/freedesktop/UPower/devices/DisplayDevice
  power supply:         yes
  updated:              śro, 23 lip 2025, 13:43:08 (28 seconds ago)
  has history:          no
  has statistics:       no
  battery
    present:             yes
    state:               discharging
    warning-level:       none
    energy:              66,633 Wh
    energy-full:         36,2634 Wh
    energy-rate:         4,3434 W
    charge-cycles:       N/A
    time to empty:       15,3 hours
    percentage:          183,747%
    icon-name:          'battery-full-symbolic'

After I added some debugging code in src/up-daemon.c (ppa:dgadomski/test
upower) I figured that energy_full_total is set only to the energy_full
of the first battery, while energy_total has the sum of both batteries:

journal -b 0 -u upower.service
(...)
lip 23 13:39:37 zack upowerd[3578]: TI:13:39:37        battery 0, energy: 36,263400, energy_full: 36,263400, energy_rate: 0,011400, time_to_empty: 11>
lip 23 13:39:37 zack upowerd[3578]: TI:13:39:37        battery 1, energy: 30,688800, energy_full: 0,000000, energy_rate: 4,879200, time_to_empty: 226>
lip 23 13:39:37 zack upowerd[3578]: TI:13:39:37        Calculating percentage and time to full/to empty for 2 batteries
lip 23 13:39:37 zack upowerd[3578]: TI:13:39:37        energy_total: 66,952200 energy_full_total: 36,263400

This leads the total percentage to exceed 100% which should never be the
case as I understood from the code.

This results also in broken UI in gnome-control-center expecting the
percentage to go as high as 100% (screenshot attached).

The actual cause to this is why the battery 1 reports energy_full as 0.

Test plan:
1. Suspend the machine
2. Resume from suspend.
3. Go to 1 if battery percentage is <=100%.

** Affects: upower (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of
Debcrafters packages, which is subscribed to upower in Ubuntu.
https://bugs.launchpad.net/bugs/2117707

Title:
  More than 100% battery reported with 2+ batteries

Status in upower package in Ubuntu:
  New

Bug description:
  I can reproduce it after a couple of tries on my Dell Rugged 5430
  equipped with 2 batteries. My assumption is that may happen on any
  hardware with 2+ batteries with plucky and upower 1.90.7-1build1.

  Sometimes after resuming from suspend upower reports more than 100%
  percentage on the DisplayDevice composite battery:

  upower -d /org/freedesktop/UPower/devices/DisplayDevice

  Device: /org/freedesktop/UPower/devices/DisplayDevice
    power supply:         yes
    updated:              śro, 23 lip 2025, 13:43:08 (28 seconds ago)
    has history:          no
    has statistics:       no
    battery
      present:             yes
      state:               discharging
      warning-level:       none
      energy:              66,633 Wh
      energy-full:         36,2634 Wh
      energy-rate:         4,3434 W
      charge-cycles:       N/A
      time to empty:       15,3 hours
      percentage:          183,747%
      icon-name:          'battery-full-symbolic'

  After I added some debugging code in src/up-daemon.c
  (ppa:dgadomski/test upower) I figured that energy_full_total is set
  only to the energy_full of the first battery, while energy_total has
  the sum of both batteries:

  journal -b 0 -u upower.service
  (...)
  lip 23 13:39:37 zack upowerd[3578]: TI:13:39:37        battery 0, energy: 36,263400, energy_full: 36,263400, energy_rate: 0,011400, time_to_empty: 11>
  lip 23 13:39:37 zack upowerd[3578]: TI:13:39:37        battery 1, energy: 30,688800, energy_full: 0,000000, energy_rate: 4,879200, time_to_empty: 226>
  lip 23 13:39:37 zack upowerd[3578]: TI:13:39:37        Calculating percentage and time to full/to empty for 2 batteries
  lip 23 13:39:37 zack upowerd[3578]: TI:13:39:37        energy_total: 66,952200 energy_full_total: 36,263400

  This leads the total percentage to exceed 100% which should never be
  the case as I understood from the code.

  This results also in broken UI in gnome-control-center expecting the
  percentage to go as high as 100% (screenshot attached).

  The actual cause to this is why the battery 1 reports energy_full as
  0.

  Test plan:
  1. Suspend the machine
  2. Resume from suspend.
  3. Go to 1 if battery percentage is <=100%.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/upower/+bug/2117707/+subscriptions



Follow ups