Accessing MTP device over USB using BASH (OSX)

There are a number of 3rd party apps that allow access of MTP devices over usb. here are just 2 http://mac.eltima.com/sync-mac.html http://mac.eltima.com/mtp-file-transfer.html

So my question is, why isn't it possible to do this directly using bash commands? Any bash experts care to chime in?

This article on MTP devices from windows

suggests that exposing MTP device as a read/write filesystem is not possible.

If so, how do the apps accomplish this?


Solution 1:

I am not a bash expert, but from USB standpoint you can't do this. A USB device is either the MTP class device, or Mass Storage class device.

If the device is MTP, host system needs MTP driver to operate it. File system is behind MTP wrapper.

If the device is Mass Storage, the system will load a mass storage driver.

Mobile phones used to have a manual option to change the USB mode of operation. More recently the Mass Storage option is not offered, because of high possibility of data corruption.

Of course, it is technically possible to have some proprietary switch protocol over USB to change the USB device class back and forth. To complete the switch, the device must disconnect from USB and them re-reconnect under new incarnation.

Solution 2:

You can install FuseFS (https://osxfuse.github.io/) and the mtp filesystem (https://www.adebenham.com/mtpfs/) for Fuse and access the device this way.