I've been playing with flashing different versions of the PinePhone OSes and noticed that when I use versions updated in the last few months, the charge level displayed on the battery icon is now incorrect. I've seen this on both Mobian and PostmarketOS with Plasma mobile and Phosh.
More specifically, on my PinePhone it displays a quarter of the battery percentage it used to show.
I haven't found much discussion of this (though there was this: https://forum.pine64.org/showthread.php?tid=17056). Who else is seeing this?
In frustration, I took a look at the code and Phosh just pulls the charge level from upowerd for the "display" device which seems to be the right way to do it.
So, I went looking at the documentation and then the source code for the UPower daemon. Sure enough, the way the battery percentage is calculated was changed in July this year:
https://gitlab.freedesktop.org/upower/up...4d_236_242
That code after the "else" didn't used to be there, so it's probably what's dividing up the charge level to a fraction of what it should be on the PinePhone. The PinePhone seems to report multiple battery devices that have no charge, in addition to one that corresponds to what I would expect.
I'm not too sure what or who are at fault here - whether the PinePhone is reporting battery data in a non-standard or incomplete way, or if there's a bug in UPower, so not sure where to raise the issue.
I think I'm going to see how easy it is to compile a patched version of the UPower daemon, with that line after the "else" removed, to solve the issue on my PinePhone.
More specifically, on my PinePhone it displays a quarter of the battery percentage it used to show.
I haven't found much discussion of this (though there was this: https://forum.pine64.org/showthread.php?tid=17056). Who else is seeing this?
In frustration, I took a look at the code and Phosh just pulls the charge level from upowerd for the "display" device which seems to be the right way to do it.
So, I went looking at the documentation and then the source code for the UPower daemon. Sure enough, the way the battery percentage is calculated was changed in July this year:
https://gitlab.freedesktop.org/upower/up...4d_236_242
Code:
/* use percentage weighted for each battery capacity
* fall back to averaging the batteries.
* ASSUMPTION: If one battery has energy data, then all batteries do
*/
if (energy_full_total > 0.0)
percentage_total = 100.0 * energy_total / energy_full_total;
else
percentage_total = percentage_total / num_batteries;
That code after the "else" didn't used to be there, so it's probably what's dividing up the charge level to a fraction of what it should be on the PinePhone. The PinePhone seems to report multiple battery devices that have no charge, in addition to one that corresponds to what I would expect.
I'm not too sure what or who are at fault here - whether the PinePhone is reporting battery data in a non-standard or incomplete way, or if there's a bug in UPower, so not sure where to raise the issue.
I think I'm going to see how easy it is to compile a patched version of the UPower daemon, with that line after the "else" removed, to solve the issue on my PinePhone.