Incorrect power supply type detection in upower

Bastien Nocera hadess at hadess.net
Wed Jun 4 15:42:17 PDT 2014


On Wed, 2014-06-04 at 22:34 +0200, Vojtech Bocek wrote:
> 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.

Simply fix the driver to export a "type". That's the way you'd fix it
for any of the in-kernel drivers.



More information about the devkit-devel mailing list