MTP for Android, Digicam or other little devices

tips-forum

#1

Android moved from USB Mass storage to MTP (Media Transfer Protocol). MTP is a successor of PTP, what is used mostly for picture transfer from digital cameras to pc/laptop.
With USB Mass Storage you’ll need to mount the filesystem in your operating system. Since the most filesystems are not very great at concurrent read/write operations, you’d need to umount the filesystem from your digicam, mobile phone or other embedded device. With MTP as protocol (interface) you can assess files on the device without the umount/mount orgies.

To use MTP on elife, I’ll suggest to install the packages jmtpfs and mtp-tools.

~>>> sudo apt-get install jmtpfs mtp-tools

Connect your mobile phone via USB and run mtp-detect.
In case of a Sony Xperia X, the phone needs to be unlocked (home screen). Else the output is something like:

~ ❯❯❯ mtp-detect
libmtp version: 1.1.3

Listing raw device(s)
Device 0 (VID=0fce and PID=01e0) is UNKNOWN.
Please report this VID/PID and the device model to the libmtp development team
   Found 1 device(s):
   0fce:01e0 @ bus 5, dev 4
[...]
usb_clear_halt() on INTERRUPT endpoint: No such device
usb_open(): No such file or directory
LIBMTP PANIC: Could not init USB on second attempt
Unable to open raw device 0
OK.

If the screen got locked after one connect, it’s no problem. The unlocked screen shows something like:

~ ❯❯❯ mtp-detect
libmtp version: 1.1.3

Listing raw device(s)
Device 0 (VID=0fce and PID=01e0) is UNKNOWN.
Please report this VID/PID and the device model to the libmtp development team
   Found 1 device(s):
   0fce:01e0 @ bus 5, dev 5
Attempting to connect device(s)
Android device detected, assigning default bug flags
[.. a lot of lines ..]
MTP-specific device properties:
   Friendly name: Xperia X
   Synchronization partner: (NULL)
   Battery level 58 of 100 (58%)
libmtp supported (playable) filetypes:
   Audio Video Interleave
   Folder
   Text file
   HTML file
   RIFF WAVE file
   ISO MPEG-1 Audio Layer 3
   JPEG file
   BMP bitmap file
[...]
   Abstract Playlist file
   XML file
   Free Lossless Audio Codec (FLAC)
OK.

Now you’ll need a writable directory. /mnt/tmp doesn’t work, so I’m using a directory in home.

>>> mkdir -p ~/android/
>>> jmtpfs ~/android/
[.. now do what you want, using a shell or a filemanager ..]

>>> fusermount -u ~/android/
(alternative 'sudo umount /home/[user]/android', see 'mount')

It is also helpful to use the ‘Garmin Vivoactive 3 Music’, that is using MTP to transfer Music via MTP