Disable power to USB hub

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.

Edit for anyone looking for this same issue later: I ended up using a "true" USB-C switcher to either power the smartphone, or connect the hub/peripheral (which is powered by the phone). This allows phone to enter sleep correctly

5 points · 2 comments · view on lemmy.world

2 Comments

frongt@lemmy.zip · 3 pts · 346d (1 reply)

Yes, the setting is the one you found. If it doesn't work, I would reevaluate how you have the devices connected.

Yaky@slrpnk.net · 1 pts · 345d

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?