Hi all!

Is it possible to prevent an Android device from providing power to a connected USB accessory? (I.e. I want the Android device to use USB/OTG devices, be charged by them, but never provide power to them)

The setup: I have a Lineage 21 / Android 14 device that is connected to a USB-C hub, which are all in a car. When USB hub has power, it acts as a host, charging the device, and everything is OK. But when USB hub loses power (car is turned off), Android device re-connects to the hub, but now Android device is powering the hub, which drains the battery very quickly.

What I want to achieve: When USB hub loses power, Android device acts as if the hub is entirely disconnected, enters sleep, and can be in sleep until it receives power again.

I did not find any straightforward solutions yet. Attempting to change USB setting for “powered by this device” did not work, nor did trying to write commands to some /sys/power files. My next thought is some form of an automatic hardware switch.

  • Yaky@slrpnk.netOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    12 hours ago

    I am not sure what you mean. Is there a different way to connect a USB-C hub to a smartphone other than the only USB-C port?