Mtp ���������� ��� linux

Media Transfer Protocol

The Media Transfer Protocol (MTP) can be used to transfer media files to and from many mobile phones (all Windows Phone 7/8/10 devices, most newer Android devices) and media players (e.g. Creative Zen).

Contents

Connecting

To connect your computer to a device via MTP:

  • the device needs to be connected to your computer via USB
  • MTP needs to be enabled on the device
  • the device’s screen needs to be unlocked (for security reasons)

FUSE filesystems

The following programs let you access MTP devices via a FUSE filesystem.

For the FUSE-based file systems, you might need to create the mount-point directory first. The directory

/mnt is used in the examples below.

FUSE mounts can generally be unmounted using fusermount -u mountpoint .

Android File Transfer

Android File Transfer — MTP client with CLI, Qt UI, and FUSE wrapper which uses a custom MTP implementation

Mount your device on

If you want album art to be displayed, it must be named albumart.xxx and placed first in the destination folder. Then copy other files. Also, note that fuse could be 7-8 times slower than ui/cli file transfer.

If you want to interact with it via the command line interface, run the command:

Type help in order to list all the commands available, exit to quit.

If you want to interact with it via the graphical user interface, start the android-file-transfer application, choose a destination folder and click any button on the toolbar. Available options are: Upload Album, Upload Directory and Upload Files. The latter two are self-explanatory. Upload album searches the source directory for album covers, and sets the best available cover.

MTPfs

MTPfs — based on libmtp, it is a FUSE filesystem that supports reading and writing from any MTP device

First edit your /etc/fuse.conf and uncomment the following line:

Mount your device on

jmtpfs

jmtpfs — based on libmtp for accessing MTP (Media Transfer Protocol) devices

Mount device on

Make this cohere to the rest of Linux (use regular mount/umount commands) by doing two steps

add this line to /etc/fstab ;

Now mount the device and see if the options «took»

SIMPLE-MTPFS

SIMPLE-MTPFS — based on libmtp Simple Media Transfer Protocol FileSystem is a file system capable of operating on files on MTP devices attached via USB to local machine

Run simple-mtpfs -l to list detected devices.

To mount the first device in the list to

/mnt , run simple-mtpfs —device 1

go-mtpfs

go-mtpfs — FUSE filesystem with custom MTP implementation, written in Go

Install android-udev , which will allow you to edit /etc/udev/rules.d/51-android.rules and apply to your idVendor and idProduct , which you can see after running mtp-detect. To the end of the line, add your user OWNER=» » .

Mount device on

libmtp

libmtp is a library MTP implementation, which also comes with some example command-line tools (which you can list using pacman -Ql libmtp ).

Читайте также:  Linux mint мы ubuntu мы debian мы fedora

Run mtp-detect to detect your device.

If an error is returned, make sure your user is in the uucp user group.

You can transfer files using the mtp-connect command.

Frontends

gMTP — A graphical frontend for libmtp. It lets you connect to Android devices and manage files using a desktop agnostic GUI.

Media players

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

Search for your device. It should be something like that:

And entry to /etc/udev/rules.d/51-android.rules will be this:

Also reload udev rules:

File manager integration

To view the contents of your Android device’s storage via MTP in your file manager, install the corresponding plugin:

  • For file managers that use GVFS (GNOME Files), install gvfs-mtp for MTP or gvfs-gphoto2 for PTP support.
  • For file managers that use KIO (KDE’s Dolphin), MTP support is included in kio-extras (dependency of dolphin).

After installing the required package, the device should show up in the file manager automatically and be accessible via an URL, for example mtp://[usb:002,013]/ .

gvfs-mtp

This article or section is a candidate for merging with udev.

The gvfs-mtp is available in the official repositories.

With lsusb you can get information about your device where Bus and Device numbers can be used with gvfs-mtp and device ID for creating of an udev rule.

To see detected device with enabled MTP

To mount all available connected MTP devices use inline script

To mount or dismount from a command with gvfs-mtp use Bus and Device numbers, e.g. to mount gio mount mtp://[usb:001,007]/ and to unmount gio mount -u mtp://[usb:001,007]/ . The mounted device will be available in a directory that begins with mtp:host= and is located under /run/user/$UID/gvfs/.

Disable automount of MTP devices with gvfs you will need to change value true to false for variable AutoMount that is located in /usr/share/gvfs/mounts/mtp.mount .

If your device is not showing up in the file manager then #libmtp is missing a native support and is not currently available in the list of the supported devices. If you will try to mount by using command line you may also get an error

The workaround to make it shown in the file manager is to write an udev rule for the device but it is no guaranty that you will be able to mount it with by using MTP connection.

Use ID number that represents by pattern vendorId:productID,e.g. 04b7:88a9, and make an udev rule by creating a configuration file

Reload the udev rules.

The file managers with support for gvfs will be able to show MTP devices and mount them if supported by #libmtp but if has no support and cannot be opened then change settings in the phone to PTP and install gvfs-gphoto2 for having access at least to the photos, command line mounting of PTP is a little similar to mounting of the MTP devices: gio mount gphoto2://[usb:002,019]/ .

Troubleshooting

libmtp (gvfs-mtp): filemanager (nautilus, pcmanfm, vifm and etc) hangs on accessing DCIM/Camera of Android device

Symptoms: everything works fine till moment of entering DCIM/Camera directory. In this case filemanager freezes and even in command line you cannot run even ls on that directory.

Читайте также:  Как очистить linux mint от мусора

Possible and very probable reason is the bug of libmtp.

It seems that it is caused by file with name like 20180915_180351(0).jpg . Samsung phones for example like to create files with such names.

There are several tickets (one, two and etc) and questions (one, two) about it.

So possible workaround is to use different mtp option from #FUSE filesystems like go-mtpfs for such directories or somehow change file naming policy of your phone camera (or switch to another camera app like Open Camera for example).

jmtpfs: Input/output error upon first access

Symptoms: jmtpfs successfully mounts, but as soon as one attempts to access files on the device (e.g. via ls ), an error is reported:

This appears to be a security feature: MTP does not work when the phone is locked by the lockscreen. Unlock the phone and it should work again as long as the cord remains connected.

kio-mtp: cannot use «Open with File Manager» action

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/solid/actions/solid_mtp.desktop .

Change the line Exec=kioclient exec mtp:udi=%i/ to Exec=dolphin «mtp:/» .

kio-mtp being called simultaneously by different services

Parallel usage of mtpfs and kio-mtp, as well as conflicting services using kio-mtp -music players included- should be avoided, as mentioned in this forum.

Amarok’s plugin for MTP services, for example, might be preventing Dolphin (plasma) to access different phone model’s files. Switching it off was a solution for at least one user.

Android File Transfer: connect failed: no MTP device found

After installing android-file-transfer , while trying to mount any MTP device if you get the following error:

then install the package: android-udev . This package contains per manufacturer/device udev rules for MTP devices, making it easier to use ADB or MTP.

Источник

Android от А до Я: Что кроется за аббревиатурой MTP, и как правильно этим распорядиться

МTP (Media Transfer Protocol) впервые появился на Android девайсах с Honeycomb. Протокол немного отличается от привычного USB Mass Storage (UMS), при котором вы включаете USB мод и начинаете перемещать файлы. А поскольку МТР стал частью Ice Cream Sandwich на Galaxy Nexus, то неплохо было бы выяснить все нюансы. В посте мы попробуем максимально разобраться с тем, что конкретно представляет собой этот протокол, какая в нем необходимость, и как его настроить для упрощения трансфера файлов.

Что такое МТР?

МТР — это набор кастомных расширений для PTP (Picture Transfer Protocol), который направлен на трансфер файлов и связанных с ними метаданных по USB. Все еще тут? Тогда продолжим.

Изначально часть структуры Windows Media, но в 2008 МТР был стандартизирован как тип USB устройства, тем самым, став сформировавшимся стандартом. Ели вы были обладателем iriver или Creative MP3 плееров, вы вероятно сталкивались с МТР. Если вы пользуетесь цифровой камерой, которая при подключении к ПК автоматически распознается как устройство, то в работе задействован РТР, который, по сути, является тем же, что и МТР. Вещь достаточно старая, но не для Android.

Зачем использовать MTP вместо USB Mass Storage?

Суть использования MTP заключается в том, что теперь производителям мобильных девайсов не надо создавать два отдельных раздела, один для приложений, второй для медиа файлов. Раньше за ними был замечен грешок, который заключался в расширении второго раздела за счет первого, а это очень часто приводило к нехватке места для новых приложений. С МТР оба типа фалов можно хранить вместе.

Читайте также:  При восстановлении windows 10 происходит ошибка

У USB Mass Storage есть один большой недостаток — когда вы создаете разделы памяти, то один из них оказывается полностью во власти другого девайса. Это означает, что у вашего планшета или смартфона не будет доступа к этому разделу, но компьютер, к которому подключен девайс, может всячески им распоряжаться. По этой причине некоторые приложения и, особенно, виджеты, помещенные на SD карту, не работают.

Еще одним преимуществом МТР является отсутствие необходимости использования файловой системы FAT для хранения. Это в конечном итоге приводит к более быстрой работе девайса.

Установка МТР

Со времен Windows XP MTP девайсы без пролем работают с Windows . Подключаете свой Galaxy Nexus , выбираете MTP в качестве типа соединения, операционная система компьютера сама находит нужные драйвера, вам необходимо будет лишь немного подождать. Перемещение файлов между смартфоном и ПК без каких-либо проблем обеспечено. Но что делать тем пользователям, которые отдали предпочтение Linux и Mac ?

Mac OS

Ребята с Android сделали этот процесс максимально безболезненным. Вам необходимо просто скачать и установить программу Android File Transfer, подключить девайс к компьютеру, запустить приложение и начать работу. Вы можете перетаскивать любые файлы как с устройства, так и на устройство, но объем каждого отдельного не должен превышать 4 ГБ.

Linux

С Linux начинаются некоторые трудности. Вы не добьетесь необходимой цели в один клик, но зато сможете детально изучить все происходящие при этом процессы. Не отчаивайтесь, просто придется немного повеселиться с командным окном. Вот как надо использовать Galaxy Nexus с Ubuntu:

Установите UDEV rule, открыв rules файл через терминал

sudo nano -w /etc/udev/rules.d/51-android.rules

Затем введите следующую строку внизу файла (на забудьте указать имя пользователя):

После чего настанет черед для:

  • sudo apt-get install mtpfs
  • sudo mkdir /media/GNexus
  • sudo chmod 775 /media/GNexus

Затем следует подключить Galaxy Nexus к ПК и в том же, что и ранее окне ввести:

sudo mtpfs -o allow_other /media/GNexus

Это все позволит вам перетаскивать файлы, используя Nautilus, и не забудьте ввести следующую команду по завершении работы:

sudo umount mtpfs

Альтернатива

В качестве альтернативы можете использовать комбинацию Wifi File Explorer и QuickSSHd и отправлять файлы по беспроводному соединению.

Похожие публикации:

подскажите подключил планшет(galaxy tab 8.9) к ноуту,пишет подключено USB испоьльзкется MTP. Скачал кис.всеравно не видит устройство.помогите

можно карту памяти открыть через проводник виндоус

Когда вы подключаете телефон как USB Mass Storage, то вы отдаёте флешку телефона в безраздельное пользование компьютеру и он рассматривает её как своё устройство, загружает для неё драйвер, оперирует со структурой файловой системы.
Драйвер компьютера несёт ответственность за целостность файловой системы на флешке.

Когда вы работаете, через MTP, то компьютер работает с телефоном, а не с его флешкой
и работает не как с устройством хранения данных, а как с отдельным равноправным устройством, у которого можно запрашивать файлы. Все операции с файловой системой флешки выполняет сам телефон по просьбе компьютера направленной через MTP.

При работе через MTP

Подскажите, после обновления версии Адндройд до 5.0.2 при подключению к ПК появляется сообщение на телефоне что подключено как MTP-устройство. Но как теперь перекинуть фото на компьютер не пойму

Ведронутые совсем ебанулись. Найти, скачать, установить программу чтобы перекинуть кому-то файл.Напоминает времена дядюшки Ляо, когда каждый производитель требовал свою программу для трансфера. Нет уж Спасибо, я лучше на люмяше с дрисняточкой буду подключать и перекидывать, подключать и перекидывать, подключать и перекидывать,пока не надоест.

Это объяснение как минимум для специалиста по «структуре Windows Media». Уверен автор этого опуса и сам не понимает что пишет.

Источник

Оцените статью