This post answers the questions:
- What is MTP (Media Transfer Protocol)?
- How can I manage files on my media device by simply copying files?
- How do I manage a MTP USB device through the file manager on Linux?
- How do I use jmptfs?
So… I’ve just gone and bought a little Sony Walkman Series B and was looking forward to trying it out on my Xubuntu 14.04 install with Clementine.
The Walkman Series B comes with an integrated USB connector for transfer and recharging, which I plugged into a USB 3.0 port. Alas, rather than using a common interface such as the block file system, the device uses the Media Transfer Protocol only interface.
Media Transfer Protocol is a way that a device such as a phone, camera or music player can show itself to the computer, and generally requires special software to add/remove files to. To wit:
Problem #1 – after double-clicking the desktop icon, it took a few seconds to mount, during which I double-clicked it again (thinking my taps on the touchpad may have been too light…) and was presented with a “could not mount” error. Ouch. But it mounted after that.
Problem #2 – it was not mounted as a block device (read: regular hard disk) but as a MTP transfer. Maybe it’s Thunar, or maybe it’s an inherent limitation in the protocol, but this did not allow me to move/add/delete files at all.
Problem #3 – After firing up Clementine, it seems the device was detected as practically full. I had a number of Clementine crashes over my various attempts at copying files from my library over as well. Ghastly procedure.
Workaround – after doing a little bit of reading up, I found that the most seamless solution was to mount the device as a block file system by way of an added library called “jmtpfs” installed following the incantation
sudo apt-get install jmtpfs
Now you can use the command line to mount and unmount the first MTP device found using various commands. I opted to create a script to do this for me: I created a script in my ~/bin directory (which is already in my path) called “mmtpfs” containing:
#! /bin/bash MTPMAIN=~/mmtpfs MTPDIR=$MTPMAIN/$2 if [ "${1}k" = '-mk' ]; then mkdir -p $MTPDIR jmtpfs $MTPDIR elif [ "${1}k" = '-uk' ]; then fusermount -u $MTPDIR rmdir $MTPDIR # only removes end directory if empty rmdir $MTPMAIN else echo Help: cat << EOT Mount the first MTP device to ~/media/MOUNTDIR Only specify the name of a directory as MOUNTDIR Mount device: $0 -m MOUNTDIR Unount device: $0 -u MOUNTDIR EOT fi
Now I can just open the terminal and type
mmtpfs -m sony
To mount the device or
mmtpfs -u sony
to unmount the device. I might make a Zenity script and a .desktop entry to make it even easier to manage should I have to add this to a user’s configuration.
Recent Comments