UPower /capacity_level parsing for batteries (was Droid 4 power_supply/battery sysfs properties (cpcap-battery))
Merlijn Wajer
merlijn at wizzup.org
Sat Mar 3 19:27:58 UTC 2018
Hi,
I was wondering why UPower only parses /capacity_level when a device is
not a battery (per up_device_supply_refresh, which calls
up_device_supply_refresh_battery for batteries, and
up_device_supply_refresh_device for everything else).
Only up_device_supply_refresh_device looks at capacity levels.
Please see email below for some more information.
Cheers,
Merlijn
-------- Forwarded Message --------
Subject: Droid 4 power_supply/battery sysfs properties (cpcap-battery)
Date: Sat, 3 Mar 2018 20:18:24 +0100
From: Merlijn Wajer <merlijn at wizzup.org>
To: Sebastian Reichel <sre at kernel.org>
CC: linux-pm at vger.kernel.org, linux-omap at vger.kernel.org, Tony Lindgren
<tony at atomide.com>
Hi,
I'm trying to get UPower to return a non-zero battery percentage on the
Droid4, and I'm running into some problems, related to the values
exposed in sysfs, here:
/sys/devices/platform/44000000.ocp/48098000.spi/spi_master/spi0/spi0.0/48098000.spi:pmic at 0:battery/power_supply/battery/
I first noticed that /capacity was not available, but /capacity_level
is. Reading Documentation/power/power_supply_class.txt, it seems that
/capacity should only be available when the hardware supports it (and
not extrapolated from voltage levels for example) - unchanged since
initial commit in 2007.
It goes on to suggest that userspace could perhaps do something clever
to deal with lack of these values. UPower can fall back to reading
/energy_now and /energy_full ; but this is also not available.
As far as I can tell, it doesn't (want to?) deal with extrapolating
based on min/max/current voltage.
If the device is not a battery (!), UPower will also try to set a rough
estimate based on /capacity_level, which would work for the Droid4,
except that ... it is a battery, so UPower decides not to read
/capacity_level. (I will see about filing a bug with them about this)
My question is - would it be possible to get /energy_now and
/energy_full available as properties, or does the chip not expose this?
(I guess that if it did, /capacity would also be available?)
Other suggestions are also appreciated.
Cheers,
Merlijn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/devkit-devel/attachments/20180303/670ce5fd/attachment.sig>
More information about the devkit-devel
mailing list