OTG is a very useful feature for many as it can allow you to transfer data over your device’s micro USB or USB-C port. You can hook up a hard drive, play games with a controller, or listen to music. Some device manufacturers specifically allow it, and OnePlus is one of them. One of the major issues with the feature in OxygenOS is that it automatically switches off if not used for ten minutes, requiring users to re-enable it whenever they want to make use of it. Thanks to XDA Senior Member Fif_, there’s an easy way to avoid this and it doesn’t even require root. All you need is adb, which you can learn how to set up on your computer here. You can also use root if you wish to do it on your device with an application like Termux.
Firstly, you’ll need to enable OTG on your device. You can do that by opening Settings -> Advanced and enable “OTG storage.”
Step 2 – Permanently enable OTG
Next, you’ll need to run an adb command. Remove the “adb shell” prefix if you are running this command in a terminal emulator on your device.
adb shell settings put global oneplus_otg_auto_disable 0
You can verify that the setting has changed with the following command.
adb shell settings get global oneplus_otg_auto_disable
And now you’re done! Keep in mind that every time you disable OTG and re-enable it, you will need to run this command again. As a result, we recommend doing it inside of a rooted terminal if you can. This will save you from having to reconnect your phone to your computer every time. You no longer have to go back and make sure it’s enabled on your device. All the command does is change a system flag to stop your phone switching OTG off automatically. This is confirmed working on the OnePlus 3, OnePlus 3T, OnePlus 5, OnePlus 5T, and the OnePlus 6. It should work for every OxygenOS version released for those devices as well.