Skip to content

charger.target: fix poweroff-poweron loop on some devices

So, on some devices, the Android container will recognize the charging mode correctly, but will not stay in that mode (shutting down instead). This happens because the charger binary thought that the charger wasn't plugged in.

As it turns out, there's a line in usb-moded documentation that said [1]:

There is the special case where the config option is called "ask". In this case usb_moded will enable a fake mass_storage profile to enable enumeration so charging can be done, and wait until it is instructed which mode needs to be selected.

Which subtly implies that USB mode must be configured in order for charging to happen. And because I've prevented Android container from doing it [2], usb-moded has to step up for this task.

So we bring usb-moded.service up also for charger.target. usb-moded, while not receiving an init_done signal, will stays in the charging_only, thus should be safe to let it run.

[1] https://github.com/sailfishos/usb-moded/blob/master/docs/usb_moded-doc.txt [2] https://github.com/Halium/hybris-patches/pull/60

Fixes: ubports/porting/reference-device-ports/android11/volla-phone-22/volla-mimameid#6 (closed)

Merge request reports