Enable OTG with a shell command I'm running Android Pie on a rooted OnePlus 6, and I wanted to know how I can enable OTG with a shell command. I need this in order to automate some tasks.

There is a setting that can toggle OTG, found in settings &gt; system &gt; OTG storage, so I figured something like this would work:

settings put global otg_enabled 1


However I'm unsure what the setting for OTG is actually called; I tried a bunch of possibilities but none seemed to work. Also tried googling it, but found nothing.

Anyone able to help me out here?
Note: the solution is tested on a rooted OnePlus 6 running OxygenOS (Android 8, 9, 10).

The command I use is:
adb shell su -c 'setprop persist.sys.oem.otg_support true'

Some folks on some  forums suggested to toggle the value for the global settings key oneplus_otg_auto_disable, but it never worked out for me. My solution survives reboot and OTG would work even when decryption password is not supplied.
I automate the solution for fail-safe scenario (in case something disable the OTG)  using Tasker app. My task is:
Code → Run Shell:

setprop persist.sys.oem.otg_support true
enable Use Root

I then assign the task to a boot event profile so that the task runs during startup.