MTP is the "Media Transfer Protocol" and is used by many MP3 players such as the Creative Zen and some Walkmans. In addition, Android phones and tablets use it since version 3.0. It is part of the "Windows Media" Framework and has close relationship with Windows Media Player.

+

MTP is the "Media Transfer Protocol" and is used by many mp3 players (e.g. Creative Zen) and mobile phones (e.g. Android 3+ devices). It is part of the "Windows Media" Framework and has close relationship with Windows Media Player.

==Installation==

==Installation==

−

MTP support is provided by the [http://libmtp.sourceforge.net/ libmtp] package, to install:

+

MTP support is provided by [http://libmtp.sourceforge.net/ libmtp], [[pacman|installable]] with the {{Pkg|libmtp}} package from the [[official repositories]].

−

pacman -S libmtp

+

==Usage==

==Usage==

−

After installation, you have several mtp tools available.

+

After installation, you have several MTP tools available.

Upon connecting your MTP device, you use:

Upon connecting your MTP device, you use:

−

mtp-detect

+

# mtp-detect

to see if your MTP device is detected.

to see if your MTP device is detected.

To connect to your MTP device, you use:

To connect to your MTP device, you use:

−

mtp-connect

+

# mtp-connect

−

If connection is successful, you will be given several switch options in conjunction with mtp-connect to access data on the device.

+

If connection is successful, you will be given several switch options in conjunction with {{ic|mtp-connect}} to access data on the device.

There are also several stand alone commands you can use to access your MTP device such as,

There are also several stand alone commands you can use to access your MTP device such as,

−

{{Note | Some commands maybe harmful to your MTP device!!! }}

+

{{Warning | Some commands may be harmful to your MTP device!!! }}

mtp-albumart mtp-emptyfolders mtp-getplaylist mtp-reset mtp-trexist

mtp-albumart mtp-emptyfolders mtp-getplaylist mtp-reset mtp-trexist

Line 26:

Line 26:

==Using media players==

==Using media players==

−

You can also use your mtp device in music players such as Amarok. To do this you may have to edit "/etc/udev/rules.d/51-android.rules" (The MTP device used in the following example is a Galaxy Nexus):

+

You can also use your MTP device in music players such as Amarok. To do this you may have to edit {{ic|/etc/udev/rules.d/51-android.rules}} (the MTP device used in the following example is a Galaxy Nexus):

{{Note | After installing MTP you may have to reboot for your device to be recognised''}}

+

{{Note|After installing MTP you may have to reboot for your device to be recognised}}

==mtpfs==

==mtpfs==

−

Mtpfs is FUSE filesystem that supports reading and writing from any MTP device. Basically it allows you to mount your device as an external drive.<br> It's available in the community repository.

+

Mtpfs is FUSE filesystem that supports reading and writing from any MTP device. Basically it allows you to mount your device as an external drive.

+

+

Mtpfs can be installed with the packge {{Pkg|mtpfs}}, available from the [[official repositories]].

*First edit your {{ic|/etc/fuse.conf}} and uncomment the following line:

*First edit your {{ic|/etc/fuse.conf}} and uncomment the following line:

user_allow_other

user_allow_other

+

*To mount your device

*To mount your device

−

# mtpfs -o allow_other /media/YOURMOUNTPOINT

+

$ mtpfs -o allow_other /media/YOURMOUNTPOINT

*To unmount your device

*To unmount your device

−

$ umount /media/YOURMOUNTPOINT

+

$ fusermount -u /media/YOURMOUNTPOINT

+

*To unmount your device as root

+

# umount /media/YOURMOUNTPOINT

+

Also, you can put them into your ~/.bashrc:

Also, you can put them into your ~/.bashrc:

alias android-connect="mtpfs -o allow_other /media/YOURMOUNTPOINT"

alias android-connect="mtpfs -o allow_other /media/YOURMOUNTPOINT"

−

alias android-disconnect="sudo umount /media/YOURMOUNTPOINT"

+

alias android-disconnect="fusermount -u /media/YOURMOUNTPOINT"

+

Or, with sudo

+

alias android-disconnect="sudo umount -u /media/YOURMOUNTPOINT"

{{Note|if you want not be asked for password when using sudo, please refer to [[USB Storage Devices#Mounting USB devices]]}}

{{Note|if you want not be asked for password when using sudo, please refer to [[USB Storage Devices#Mounting USB devices]]}}

+

+

==jmtpfs==

+

[http://research.jacquette.com/jmtpfs-exchanging-files-between-android-devices-and-linux/ jmtpfs] is a FUSE and libmtp based filesystem for accessing MTP (Media Transfer Protocol) devices. It was specifically designed for exchanging files between Linux systems and newer Android devices that support MTP but not USB Mass Storage.

+

jmtpfs is available as {{aur|jmtpfs}} in the [[AUR]].

+

+

Use these commands to mount and unmount your device :

+

$ jmtpfs ~/mtp

+

+

$ fusermount -u ~/mtp

+

+

==go-mtpfs==

+

{{Note|Go-mtpfs gives a better performance while writing files to some devices than mtpfs/jmtpfs. Try it if you have slow speeds.}}

+

If the above instructions don't show any positive results one should try {{aur|go-mtpfs-git}} from the [[AUR]].

If you want do it simpler, install {{Pkg|go}}, {{Pkg|libmtp}} and {{Pkg|git}} from the [[official repositories]]. After that install {{AUR|go-mtpfs-git}} from the [[AUR]].

+

+

+

As in the section above install {{aur|android-udev}} which will provide you with "/usr/lib/udev/rules.d/51-android.rules" edit it to apply to

+

your vendorID and productID, which you can see after running mtp-detect. To the end of the line add with a comma OWNER="yourusername". Save the file.

+

+

*Add yourself to the "fuse" group:

+

gpasswd -a [user] fuse

+

+

*If the group "fuse" doesn't exist create it with:

+

groupadd fuse

+

+

Logout or reboot to apply these changes.

+

+

*To create a mount point called "Android" issue the following commands:

+

mkdir Android

+

+

*To mount your phone use:

+

go-mtpfs Android

+

+

*To unmount your phone:

+

fusermount -u Android

+

+

You can create a .bashrc alias as in the example above for easier use.

+

+

==gvfs-mtp==

+

+

Philip Langdale is has implemented native MTP support for gvfs. The weaknesses of gphoto2 and mtpfs are listed in his [http://intr.overt.org/blog/?p=153 blog post].

+

*The native mtp implementation for gvfs [https://bugzilla.gnome.org/show_bug.cgi?id=666195 has been merged upstream] and has been released in gvfs [http://git.gnome.org/browse/gvfs/commit/?id=d6c8e3a4910ee2c5968886328ebe9456b445796b 1.15.2].

+

* You can grab the stable {{Pkg|gvfs-mtp}} package from extra. You may want to reboot your PC to make it actually working.

+

+

*Devices will have gvfs paths like this

+

gvfs-ls mtp://[usb:002,013]/

+

+

==simple-mtpfs==

+

+

This is another FUSE filesystem for MTP devices. You may find this to be more reliable than {{Pkg|mtpfs}}. {{aur|simple-mtpfs}} is available in the AUR or can be built from source. Remember '''do not''' run the following commands as root.

+

+

* To list MTP devices run

+

simple-mtpfs --list-devices

+

+

* To mount a MTP devices (in this example device 0) run

+

simple-mtpfs /path/to/your/mount/point

+

+

* To un mount run

+

fusermount -u /path/to/your/mount/point

+

+

==KDE MTP KIO Slave==

+

There is a MTP KIO Slave built upon libmtp availiable as package {{Pkg|kio-mtp}}.

+

+

Using KIO makes file access in KDE seamless, in principle any KDE application would be able read/write files on the device.

+

+

===Usage===

+

The device will be available under the path mtp:/

+

+

===Workaround if the KDE device actions doesn't work===

+

If you are not able to use the action "Open with File Manager", you may work around this problem by editing the file /usr/share/apps/solid/actions/solid_mtp.desktop

MTP is still buggy and may crash despite the best efforts of developers. The following are alternatives:

+

* AirDroid - an Android app to access files via your web browser.

+

* FTP client on Android - If you run a local FTP server on Arch (such as [[Vsftp]]), there are many FTP clients available on the Play Store which will give read/ write access to your device's files.

+

* FTP Server on Android. Note: since FTP client using passive transfer (server connect to client) do not forget to disable firewall or adding rules for allowing FTP server connect to your PC.

+

** Ftp Server (by The Olive Tree) app in Play Store acts as FTP server on Android and allows RW access to pretty much all your storage.

+

*** Pro: Doesn't require root and just works!

+

*** Cons: Doesn't work with tethering network.

+

** FTPServer (by Andreas Liebig) - Just work.

+

* SSH server on Android.

+

** For example, SSHelper, available on the Play Store, just works without requiring root access. Assuming SSHelper is listening on port 20 and the phone's IP address is 192.168.0.20, the following command will synchronise a local directory with the external SD card of the Android device:

*** Pro: Stable, can be used for a lot more then just copy files back and forth.

+

*** Cons: Can be somewhat slow.

+

+

==Security features on android==

+

If you use android 4.x please unlock phone (screen unlock) and then connect phone to USB.

+

+

If you not unlock you have in KDE "No Storages found. Maybe you need to unlock your device?" or error 02fe in console.

Revision as of 03:09, 22 October 2013

MTP is the "Media Transfer Protocol" and is used by many mp3 players (e.g. Creative Zen) and mobile phones (e.g. Android 3+ devices). It is part of the "Windows Media" Framework and has close relationship with Windows Media Player.

Using media players

You can also use your MTP device in music players such as Amarok. To do this you may have to edit /etc/udev/rules.d/51-android.rules (the MTP device used in the following example is a Galaxy Nexus):
To do this run:

jmtpfs

jmtpfs is a FUSE and libmtp based filesystem for accessing MTP (Media Transfer Protocol) devices. It was specifically designed for exchanging files between Linux systems and newer Android devices that support MTP but not USB Mass Storage.
jmtpfs is available as jmtpfsAUR in the AUR.

Use these commands to mount and unmount your device :

$ jmtpfs ~/mtp

$ fusermount -u ~/mtp

go-mtpfs

Note: Go-mtpfs gives a better performance while writing files to some devices than mtpfs/jmtpfs. Try it if you have slow speeds.

If the above instructions don't show any positive results one should try go-mtpfs-gitAUR from the AUR.
The following has been tested on a Samsung Galaxy Nexus GSM, Asus/Google Nexus 7 (2012 1st gen model) and Samsung Galaxy S 3 mini.

As in the section above install android-udevAUR which will provide you with "/usr/lib/udev/rules.d/51-android.rules" edit it to apply to
your vendorID and productID, which you can see after running mtp-detect. To the end of the line add with a comma OWNER="yourusername". Save the file.

Add yourself to the "fuse" group:

gpasswd -a [user] fuse

If the group "fuse" doesn't exist create it with:

groupadd fuse

Logout or reboot to apply these changes.

To create a mount point called "Android" issue the following commands:

mkdir Android

To mount your phone use:

go-mtpfs Android

To unmount your phone:

fusermount -u Android

You can create a .bashrc alias as in the example above for easier use.

gvfs-mtp

Philip Langdale is has implemented native MTP support for gvfs. The weaknesses of gphoto2 and mtpfs are listed in his blog post.

You can grab the stable gvfs-mtp package from extra. You may want to reboot your PC to make it actually working.

Devices will have gvfs paths like this

gvfs-ls mtp://[usb:002,013]/

simple-mtpfs

This is another FUSE filesystem for MTP devices. You may find this to be more reliable than mtpfs. simple-mtpfsAUR is available in the AUR or can be built from source. Remember do not run the following commands as root.

To list MTP devices run

simple-mtpfs --list-devices

To mount a MTP devices (in this example device 0) run

simple-mtpfs /path/to/your/mount/point

To un mount run

fusermount -u /path/to/your/mount/point

KDE MTP KIO Slave

There is a MTP KIO Slave built upon libmtp availiable as package kio-mtp.

Using KIO makes file access in KDE seamless, in principle any KDE application would be able read/write files on the device.

Usage

The device will be available under the path mtp:/

Workaround if the KDE device actions doesn't work

If you are not able to use the action "Open with File Manager", you may work around this problem by editing the file /usr/share/apps/solid/actions/solid_mtp.desktop

GNOME gMTP

Workarounds for Android

HTC Phones automatically enter usb debugging mode on usb connect. Manually turn it off once connected to give libmtp access to the device.

MTP is still buggy and may crash despite the best efforts of developers. The following are alternatives:

AirDroid - an Android app to access files via your web browser.

FTP client on Android - If you run a local FTP server on Arch (such as Vsftp), there are many FTP clients available on the Play Store which will give read/ write access to your device's files.

FTP Server on Android. Note: since FTP client using passive transfer (server connect to client) do not forget to disable firewall or adding rules for allowing FTP server connect to your PC.

Ftp Server (by The Olive Tree) app in Play Store acts as FTP server on Android and allows RW access to pretty much all your storage.

Pro: Doesn't require root and just works!

Cons: Doesn't work with tethering network.

FTPServer (by Andreas Liebig) - Just work.

SSH server on Android.

For example, SSHelper, available on the Play Store, just works without requiring root access. Assuming SSHelper is listening on port 20 and the phone's IP address is 192.168.0.20, the following command will synchronise a local directory with the external SD card of the Android device: