Using ADB to enable File transfer mtp, USB debugging enabled, device set to charging

5.1k Views Asked by At

I have a tablet I am using for automated testing. It is set to usb debugging. If the pc reboots or cable is disconnected/reconnected the unit defaults to usb configuration = charging, but usb debugging is always enabled. adb does not detect the device. I have to manually set usb from charging to mtp file transfer for it to be detected by adb. The goal is to programmatically change the device from charging to mtp file transfer if connected or the pc reboots. Any suggestions?

1

There are 1 best solutions below

1
Bluey On

you should be able to enable MTP over ADB with the command

adb shell svc usb setFunctions mtp