upower reports 0% capacity for battery devices with incomplete energy or charge information

Bug #1209285 reported by Matt Fischer on 2013-08-07
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Upower
Triaged
Critical
Seth Forshee

Bug Description

On some devices, the driver does not report "charge_now". This means that the current power shows as 0 and percentage also shows 0. This means that the power-source code does an emergency shutdown after booting the device. It was confirmed that Android also lacks this info and so is probably a limitation of the driver. The upower output of one of the affected devices follows along with a discussion with cking.

<cking> OK, now cat the following:
<cking> /sys/devices/bms/power_supply/battery/capacity
<cking> /sys/devices/charger/power_supply/battery/charge_full_design
<ycheng> 96
<ycheng> 3200000
<ycheng> for each file
<cking> OK - I'm guessing the issue is that upower can't figure out the % full because there is no charge_now field, so it gets 0% full, however the kernel is presenting a capacity field that looks OK
<cking> in other words:
<cking> upower can't calculate the % full from charge_full_design and charge_now because there is no charge_now field
<cking> so fundamentally the device is OK

----------------------

Device: /org/freedesktop/UPower/devices/line_power_usb
  native-path: /sys/devices/msm_ddd/power_supply/usb
  power supply: yes
  updated: Thu Jan 1 00:52:35 1970 (184 seconds ago)
  has history: no
  has statistics: no
  line-power
    online: yes

Device: /org/freedesktop/UPower/devices/battery_bms
  native-path: /sys/devices/bms/power_supply/bms
  power supply: yes
  updated: Thu Jan 1 00:55:11 1970 (28 seconds ago)
  has history: yes
  has statistics: yes
  battery
    present: yes
    rechargeable: yes
    state: charging
    energy: 0 Wh
    energy-empty: 0 Wh
    energy-full: 32 Wh
    energy-full-design: 32 Wh
    energy-rate: 0 W
    percentage: 0%
    capacity: 100%

Device: /org/freedesktop/UPower/devices/line_power_ac
  native-path: /sys/devices/charger/power_supply/ac
  power supply: yes
  updated: Thu Jan 1 00:52:36 1970 (183 seconds ago)
  has history: no
  has statistics: no
  line-power
    online: no

Device: /org/freedesktop/UPower/devices/battery_battery
  native-path: /sys/devices/charger/power_supply/battery
  power supply: yes
  updated: Thu Jan 1 00:55:22 1970 (17 seconds ago)
  has history: yes
  has statistics: yes
  battery
    present: yes
    rechargeable: yes
    state: discharging
    energy: 0 Wh
    energy-empty: 0 Wh
    energy-full: 13.92 Wh
    energy-full-design: 13.92 Wh
    energy-rate: 0 W
    voltage: 4.25523 V
    percentage: 0%
    capacity: 100%
    technology: lithium-ion

Device: /org/freedesktop/UPower/devices/line_power_qpnp_dc
  native-path: /sys/devices/charger/power_supply/qpnp-dc
  power supply: yes
  updated: Thu Jan 1 00:52:36 1970 (183 seconds ago)
  has history: no
  has statistics: no
  line-power
    online: no

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

Matt Fischer (mfisch) on 2013-08-07
description: updated
Changed in powerd:
assignee: nobody → Seth Forshee (sforshee)
Seth Forshee (sforshee) wrote :

Ultimately this is a driver problem that causes upower to always report 0 for the percent charge remaining. If a driver is going to export energy_full or charge_full then it ought to also export fields for current energy and charge.

upower could be more robust in this regard however. I'm attaching a patch for upower to prevent this problem from happening when drivers supply incomplete informaton.

Seth Forshee (sforshee) wrote :

Changing affected project to upower

affects: powerd → upower
summary: - powerd shuts down devices which do not have full power info
+ upower reports 0% capacity for battery devices with incomplete energy or
+ charge information
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers