Important: You are required to change your passwords used for Gentoo services and set an email address for your Wiki account if you haven't done so. See the full announcement and Wiki email policy change for more information.

MTP

From Gentoo Wiki
Jump to: navigation, search
External resources

MTP (Media Transfer Protocol) is a protocol to allow the transfer of files to external devices.

MTPfs

Installation

Install sys-fs/mtpfs:

→ Information about USE flags
USE flag Default Recommended Description
debug No Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see http://www.gentoo.org/proj/en/qa/backtraces.xml
mad No Enable handling of MP3's metadata
root # emerge --ask mtpfs

Configuration

Your user needs to be in the "plugdev" group:

root # gpasswd -a YOUR_USER plugdev

Modify your /etc/fuse.conf:

File/etc/fuse.conf

user_allow_other

Usage

user $ mkdir ~/AndroidDevice
user $
mtpfs -o allow_other ~/AndroidDevice
Note
Be patient, as this can take several minutes. Upon successful mount, mtpfs will background itself.
  • Unmount:
user $ fusermount -u ~/AndroidDevice

Go-mtpfs

Note
Newer Galaxy Devices (S3, S4, Note2, etc.) use their own MTP-stack and don't work reliably, although this should be fixed in newer versions. See Bug#29

Installation

Install sys-fs/go-mtpfs:

We need to unmask 2 packages in /etc/portage/package.keywords:

File/etc/portage/package.keywords

dev-libs/go-fuse **
sys-fs/go-mtpfs **
root # emerge --ask go-mtpfs

Configuration

Your user needs to be in the "plugdev" group:

root # gpasswd -a YOUR_USER plugdev

Usage

user $ mkdir ~/AndroidDevice
user $
~/go/bin/go-mtpfs ~/AndroidDevice &

Note: If you don't run go-mtpfs in the background (with & at the end), you will need another console to browse the device and to unmount it.

  • unmount:
user $ fusermount -u ~/AndroidDevice

When you unmount the device, go-mtpfs will quit.

gphotofs

gphotofs is a FUSE file system for interfacing with digital cameras using gphoto2. Most modern mobile phones are cameras at the same time, and gphotofs can be a good alternative to tmpfs or go-mtpfs.

Installation

Install media-gfx/gphotofs:

Usage

user $ mkdir ~/AndroidDevice
user $
gphotofs ~/AndroidDevice -o alllow_other
  • unmount:
user $ fusermount -u ~/AndroidDevice

simple-mtpfs

Another FUSE file system implementation for use with MTP devices is simple-mtpfs.

Installation

Install sys-fs/simple-mtpfs:

Usage

user $ mkdir ~/AndroidDevice
user $
simple-mtpfs ~/AndroidDevice
  • unmount:
user $ fusermount -u ~/AndroidDevice

KDE

kio-mtp is a slave for KDE's KIO framework.

As kio-mtp is still unstable, but is now part of main repository. Then:

root # echo kde-misc/kio-mtp >> /etc/portage/package.accept_keywords
root # emerge --ask kio-mtp

Finally quit KDE, and relaunch it. Now your MTP devices appear e.g. in Dolphin.

gMTP

gMTP is a simple MTP client for Solaris and Linux.

It is just to install and run media-sound/gmtp:

root # emerge --ask gmtp
user $ gmtp

Click on connect. A few second later, you will get the file hierarchy of your device. You can start to manipulate the files. It support features like Album Artwork and play lists.

Troubleshooting

  • If your device is not recognized by libmtp, try upgrading to latest (or even live) version.
  • Sometimes (e.g. on HTC One X) USB debugging automatically turns on when device is connected to PC. You need to turn debugging off, otherwise libmtp can't recognize device.
  • Make sure your Android device is not going to sleep and the screen is not getting locked. Set screen timeout to very long values, or enable in Development section flag "Do not turn off the screen".