upower reports 0% capacity for battery devices with incomplete energy or charge information
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/
<cking> /sys/devices/
<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/freedeskto
native-path: /sys/devices/
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/freedeskto
native-path: /sys/devices/
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-
energy-rate: 0 W
percentage: 0%
capacity: 100%
Device: /org/freedeskto
native-path: /sys/devices/
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/freedeskto
native-path: /sys/devices/
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-
energy-rate: 0 W
voltage: 4.25523 V
percentage: 0%
capacity: 100%
technology: lithium-ion
Device: /org/freedeskto
native-path: /sys/devices/
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
description: | updated |
Changed in powerd: | |
assignee: | nobody → Seth Forshee (sforshee) |
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.