Change USB connection mode using ADB only (broken screen) I am trying to use Vysor to control my Moto G5 which has a broken screen (completely black). It appears to be working otherwise (rings when called etc).

However, I cannot connect to my PC using USB cable when the phone is on, because I cannot change from "Charging only" to MTP or PTP because I cannot see it on the screen. I can connect to ADB via recovery (stock and un-rooted) but all "adb shell" commands fail (error:closed) which I assume is due to not being rooted.

I am trying to change the default USB connection mode to PTP rather than "Charging only" so I can use Vysor when the phone is booted normally, not in recovery. Has anyone got any ideas?

I either need a way to made "adb shell" commands work (to follow the below link), or another way to change the USB default or another bright idea!

How Do I change from PTP to MTP mode? Cannot find options in settings
Late as I am to the party the following might be of some help:-
https://trubitsyn.dev/posts/adb-connectivity
The command svc usb setFunction &lt;mtp|ptp|rndis|midi&gt; is the most likely candidate (alternatively setFunctions is used dependant on the version of Android.