Blacklisting power sources

Florian Leeber florian at ubports.com
Mon May 10 18:26:56 UTC 2021


Richard,

thanks for the update. Yes, Android kernels are weird. There are lot of
drivers inside that are not officially supported by Linux, and they are
also not really documented. For example, the Oneplus 5 gives that
entries from upower cmdline:

/org/freedesktop/UPower/devices/battery_battery
/org/freedesktop/UPower/devices/line_power_dc
/org/freedesktop/UPower/devices/battery_main
/org/freedesktop/UPower/devices/line_power_pc_port
/org/freedesktop/UPower/devices/line_power_usb
/org/freedesktop/UPower/devices/battery_bms
/org/freedesktop/UPower/devices/DisplayDevice

The entry battery_battery is the only correct one. battey_bms mirrors a
lot of properties but always shows discharging (that confuses our middle
ware apps). battery_main is always empty. Since we are based on Ubuntu
and Canonical added a weird way of showing the state for multiple
batteries in the system we they are all considered, the more there are
the worse it gets.

We have currently around 60 different devices on the list and counting,
and its beyond our capacity to meticouosly fix all of the kernels with
such issues. Most of the porters are not kernel hackers, let alone good
C programmers, but without them we would not have that many device
options. Also, most of the kernels we have to maintain are obsolete (as
early as 3.4 all the way up to 4.4 and maybe 4.9), so investing time
into them is really not a wise choice IMHO.

So I still think a blcklist will be the easiest way to suppress wrong
device infos. I will make a PR and send it to you for review. In case
you do not accept this into UPower its also no problem, its just that we
have one more fork to maintain but this codebase does not change that
much and is easily trackable (for the time being).

BR Florian

Am 10.05.2021 um 12:37 schrieb Richard Hughes:
> On Sat, 8 May 2021 at 10:42, Florian Leeber <florian at ubports.com> wrote:
>> Following up on my investigations on our Android-based mobile devices I
>> came to the conclusion that the best solution for solving my fake
>> battery problem would be a blacklist.
> Is it being exported as a sysfs "power_supply" class?
>
>> I could add device paths that
>> should entirely be ignored by UPower and in turn all consumers. Is there
>> any such option, or could this easily be implemented?
> If it's what I think it is, you need to fix it in the kernel, not
> workaround it in userspace.
>
>> Apart from that I understand that this list has had no traffic in 2
>> months, is the project still alive?
> Yes.
>
> Richard
> _______________________________________________
> devkit-devel mailing list
> devkit-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/devkit-devel





More information about the devkit-devel mailing list