Incorrect power supply type detection in upower

Vojtech Bocek vbocek at gmail.com
Wed Jun 4 13:34:38 PDT 2014


Hello,
on Google Nexus 5, there is a Linux kernel driver used to change
charging current according to battery's temperature (too hot -> lower
the current)[1]. This driver exports as type "BMS" (battery management
system, not present in vanilla kernel) in sysfs, and because upower
considers any unknown device which doesn't have an "online" file in
sysfs a battery, it thinks the device has two batteries. This causes
the GUI to report wrong battery percentage, because it adds values
from both "batteries" (one of which is always 0) and divides them by
two.

The point is I don't think defaulting to battery is a good idea. But I
don't know if it is okay not to - will it break stuff like UPS if
upower won't default to battery? What if we check for presence of
"capacity" file in sysfs (which that temperature driver doesn't have),
is that okay?

Basically, I'd like to get this properly fixed, but I don't know
enough about power supply devices to post a patch, so I'd be glad for
any input on this issue.

Thank you,
Vojtěch Boček

PS: This is a re-post of the same e-mail, because I wasn't registered
when I sent the first one and it doesn't seem to have made it to the
mailing list.

[1]: https://android.googlesource.com/kernel/msm/+/android-msm-hammerhead-3.4-kitkat-mr1/drivers/power/battery_temp_ctrl.c


More information about the devkit-devel mailing list