Media Transfer Protocol – ArchWiki
The Media Switch Protocol (MTP) can be utilized to switch media recordsdata to and from many cellphones (all Home windows Cellphone 7/8/10 gadgets, most newer Android gadgets) and media gamers (e.g. Artistic Zen).
Connecting
To attach your pc to a tool through MTP:
- the gadget must be linked to your pc through USB
- MTP must be enabled on the gadget
- the gadget’s display must be unlocked (for safety causes)
FUSE filesystems
The next packages allow you to entry MTP gadgets through a FUSE filesystem.
Notice: MTP is messy and its implementation varies between gadgets. Attempt the under purchasers and see which one works finest together with your gadget.
Tip: It is suggested to reboot your pc after putting in MTP associated packages.
For the FUSE-based file programs, you may have to create the mount-point listing first. The listing ~/mnt
is used within the examples under.
FUSE mounts can typically be unmounted utilizing fusermount -u mountpoint
.
Android File Switch — MTP consumer with CLI, Qt UI, and FUSE wrapper which makes use of a customized MTP implementation
- https://whoozle.github.io/android-file-transfer-linux/ || android-file-transfer
Mount your gadget on ~/mnt
:
# aft-mtp-mount ~/mnt
If you wish to browse the folder as a non-root consumer, go -o allow_other
to aft-mtp-mount
. Notice that you’ll first have to uncomment user_allow_other
in /and so forth/fuse.conf
.
If you would like album artwork to be displayed, it have to be named albumart.xxx
and positioned first within the vacation spot folder. Then copy different recordsdata. Additionally, be aware that fuse could possibly be 7-Eight occasions slower than ui/cli file switch.
Run the command:
# aft-mtp-cli
Sort assist with the intention to listing all of the instructions obtainable, exit to stop.
Begin the android-file-transfer utility, select a vacation spot folder and click on any button on the toolbar. Obtainable choices are: Add Album, Add Listing and Add Recordsdata. The latter two are self-explanatory. Add album searches the supply listing for album covers, and units the very best obtainable cowl.
MTPfs — based mostly on libmtp, it’s a FUSE filesystem that helps studying and writing from any MTP gadget
- https://www.adebenham.com/mtpfs/ || mtpfs
First edit your /and so forth/fuse.conf
and uncomment the next line:
user_allow_other
Mount your gadget on ~/mnt
:
$ mtpfs -o allow_other ~/mnt
jmtpfs — based mostly on libmtp for accessing MTP (Media Switch Protocol) gadgets
- https://github.com/JasonFerrara/jmtpfs || jmtpfsAUR
Mount gadget on ~/mnt
:
$ jmtpfs ~/mnt
Make this cohere to the remainder of Linux (use common mount/umount instructions) by doing two steps
$# ln -s$ ln -s /sbin/jmtpfs /sbin/mount.jmtpfs
add this line to /and so forth/fstab
;
#jmtpfsfuse nodev,allow_other, 0 0 jmtpfs /residence/sam/run/motog fuse nodev,allow_other,rw,consumer,noauto,noatime,uid=1000,gid=1000 0 0
Now mount the gadget and see if the choices “took”
$ mount /residence/sam/run/motog Machine 0 (VID=22b8 and PID=2e82) is a Motorola Moto G (ID2). Android gadget detected, assigning default bug flags $ mount ... jmtpfs on /residence/sam/run/motog sort fuse.jmtpfs (rw,nosuid,nodev,noexec,noatime,user_id=1000,group_id=1000,allow_other,consumer=sam)
SIMPLE-MTPFS — based mostly on libmtp Easy Media Switch Protocol FileSystem is a file system able to working on recordsdata on MTP gadgets connected through USB to native machine
- https://github.com/phatina/simple-mtpfs/ || simple-mtpfsAUR
Run simple-mtpfs -l
to listing detected gadgets.
To mount the primary gadget within the listing to ~/mnt
, run simple-mtpfs --device 1 ~/mnt
.
go-mtpfs — FUSE filesystem with customized MTP implementation, written in Go
- https://github.com/hanwen/go-mtpfs || go-mtpfs-gitAUR
Set up android-udev, which is able to permit you to edit /and so forth/udev/guidelines.d/51-android.guidelines
and apply to your idVendor
and idProduct
, which you’ll be able to see after operating mtp-detect. To the tip of the road, add your consumer OWNER="
.
Mount gadget on ~/mnt
:
$ go-mtpfs ~/mnt
- When utilizing a number of gadgets you could need to use the
-d
flag to specify a tool (id may be discovered by operatingmtp-detect
- Mounting with
go-mtpfs
may fail if an exterior SD Card is current. In case you attempt to entry your gadget whereas having an SD card and go-mtpfs complains, attempt eradicating the SD card and mounting once more.)
libmtp
libmtp is a library MTP implementation, which additionally comes with some instance command-line instruments (which you’ll be able to listing utilizing pacman -Ql libmtp
).
Set up the libmtp bundle.
Run mtp-detect
to detect your gadget.
If an error is returned, make certain your consumer is within the uucp
consumer group.
You’ll be able to switch recordsdata utilizing the mtp-connect
command.
Media gamers
You too can use your MTP gadget in music gamers akin to Amarok. To attain this, you might need to edit /and so forth/udev/guidelines.d/51-android.guidelines
(the MTP gadget used within the following instance is a Galaxy Nexus).
Run:
$ lsusb
Seek for your gadget. It must be one thing like that:
Bus 003 Machine 011: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Cellphone [Galaxy S II], GT-P7500 [Galaxy Tab 10.1]
And entry to /and so forth/udev/guidelines.d/51-android.guidelines
can be this:
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666", OWNER="[username]"
Additionally reload udev guidelines:
# udevadm management --reload
File supervisor integration
To view the contents of your Android gadget’s storage through MTP in your file supervisor, set up the corresponding plugin:
- For file managers that use GVFS (GNOME Recordsdata), set up gvfs-mtp for MTP or gvfs-gphoto2 for PTP assist.
- For file managers that use KIO (KDE’s Dolphin), MTP assist is included in kio-extras (dependency of dolphin).
After putting in the required bundle, the gadget ought to present up within the file supervisor mechanically and be accessible through an URL, for instance mtp://[usb:002,013]/
.
gvfs-mtp
The gvfs-mtp is accessible within the official repositories.
With lsusb
you will get details about your gadget the place Bus and Machine numbers can be utilized with gvfs-mtp
and gadget ID for creating of an udev rule.
Bus 002 Machine 018: ID 04b7:88a9 Compal Electronics, Inc.
To see detected gadget with enabled MTP
Use gio mount:
gio mount -li | grep -e ^Quantity -e activation_root
Quantity(0): MT65xx Android Cellphone activation_root=mtp://[usb:002,018]/
Use lsusb:
lsusb -v 2> /dev/null | grep -e Bus -e iInterface -e bInterfaceProtocol
... Bus 002 Machine 018: ID 04b7:88a9 Compal Electronics, Inc. bInterfaceProtocol 0 iInterface 5 MTP ...
To mount all obtainable linked MTP gadgets use inline script
gio mount -li | awk -F= '{if(index($2,"mtp") == 1)system("gio mount "$2)}'
To mount or dismount from a command with gvfs-mtp use Bus and Machine numbers, e.g. to mount gio mount mtp://[usb:001,007]/
and to unmount gio mount -u mtp://[usb:001,007]/
. The mounted gadget can be obtainable in a listing that begins with mtp:host= and is positioned underneath /run/consumer/$UID/gvfs/.
Disable automount of MTP devises with gvfs you’ll need to alter worth true to false for variable AutoMount that’s positioned in /usr/share/gvfs/mounts/mtp.mount
.
Notice: The file managers can have personal choices for automount. On begin they checking for all obtainable mountable gadgets.
In case your gadget isn’t displaying up within the file supervisor then #libmtp is lacking a local assist and isn’t at the moment obtainable within the listing of the supported gadgets. If you’ll attempt to mount through the use of command line you may additionally get an error
Machine 0 (VID=XXXX and PID=XXXX) is UNKNOWN. Please report this VID/PID and the gadget mannequin to the libmtp growth staff
The workaround to make it proven within the file supervisor is to write down an udev rule for the gadget however it’s no warranty that it is possible for you to to mount it with through the use of MTP connection.
Use ID quantity that represents by sample vendorId:productID,e.g. 04b7:88a9, and make an udev rule by making a configuration file
/and so forth/udev/guidelines.d/51-android.guidelines
SUBSYSTEM=="usb", ATTR{idVendor}=="04b7", ATTR{idProduct}=="88a9", MODE="0660", GROUP="uucp", ENV{ID_MTP_DEVICE}="1", SYMLINK+="libmtp"
Reload the udev guidelines.
# udevadm management --reload
The file managers with assist for gvfs will be capable to present MTP gadgets and mount them if supported by #libmtp but when has no assist and can’t be opened then change settings within the telephone to PTP and set up gvfs-gphoto2 for having entry no less than to the images, command line mounting of PTP is a bit just like mounting of the MTP gadgets: gio mount gphoto2://[usb:002,019]/
.
cp
,ls
then search for gvfs personal options, ls -1 /usr/bin/gvfs-*
.Troubleshooting
libmtp (gvfs-mtp): filemanager (nautilus, pcmanfm, vifm and and so forth) hangs on accessing DCIM/Digital camera of Android gadget
Signs: all the things works high quality until second of getting into DCIM/Digital camera listing. On this case filemanager freezes and even in command line you can’t run even ls
on that listing.
Doable and really possible cause is the bug of libmtp.
It appears that evidently it’s brought on by file with title like 20180915_180351(0).jpg
. Samsung telephones for instance prefer to create recordsdata with such names.
There are a number of tickets (one, two and and so forth) and questions (one, two) about it.
So attainable workaround is to make use of totally different mtp possibility from #FUSE filesystems like go-mtpfs for such directories or someway change file naming coverage of your telephone digital camera (or change to a different digital camera app like Open Digital camera for instance).
jmtpfs: Enter/output error upon first entry
Signs: jmtpfs efficiently mounts, however as quickly as one makes an attempt to entry recordsdata on the gadget (e.g. through ls
), an error is reported:
can not entry: Enter/output error
This seems to be a safety characteristic: MTP doesn’t work when the telephone is locked by the lockscreen. Unlock the telephone and it ought to work once more so long as the twine stays linked.
kio-mtp: can not use “Open with File Supervisor” motion
If you’re not in a position to make use of the motion “Open with File Supervisor”, you could work round this downside by enhancing the file /usr/share/stable/actions/solid_mtp.desktop
.
Change the road Exec=kioclient exec mtp:udi=%i/
to Exec=dolphin "mtp:/"
.
kio-mtp being known as concurrently by totally different providers
Parallel utilization of mtpfs and kio-mtp, in addition to conflicting providers utilizing kio-mtp -music gamers included- must be prevented, as talked about on this discussion board.
Amarok’s plugin for MTP providers, for instance, is likely to be stopping Dolphin (plasma) to entry totally different telephone mannequin’s recordsdata. Switching it off was an answer for no less than one consumer.
Android File Switch: join failed: no MTP gadget discovered
After putting in android-file-transfer, whereas attempting to mount any MTP gadget in case you get the next error:
$ aft-mtp-mount /path/to/folder
join failed: no MTP gadget discovered
then set up the bundle: android-udev. This bundle comprises per producer/gadget udev guidelines for MTP gadgets, making it simpler to make use of ADB or MTP.