7

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?

Bachalo
  • 2,507
  • 13
  • 48
  • 61

2 Answers2

6

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.

silicontrip
  • 251
  • 3
  • 8
  • How does this answer the question? – yass Apr 06 '17 at 12:25
  • 1
    it will allow you to mount the MTP device as a file system and access it like you would a disk, from the command line. – silicontrip May 31 '17 at 06:47
  • mtpfs does not build on OS X currently. – James Dunne Jun 13 '17 at 18:10
  • I used this implementation: https://github.com/JasonFerrara/jmtpfs – silicontrip Jun 22 '17 at 05:09
  • Can you detail how you build it? and for which version of macOS? – Ortomala Lokni Aug 17 '17 at 20:23
  • Since this is a question about bash. I'm going to assume that you know how to have a working build environment and know how to configure and build software. – silicontrip May 29 '18 at 04:40
  • Since this is a question about bash. I'm going to assume that you know how to have a working build environment and know how to configure and build software. First clone the repository; git clone https://github.com/JasonFerrara/jmtpfs.git The undefined errors are simply part of the headers and the headers so simply add: #include #include to src/mtpFilesystemErrors.h – silicontrip May 29 '18 at 06:53
2

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.

Ale..chenski
  • 12,414
  • 4
  • 35
  • 46