目录
Media Transfer Protocol (MTP) is used for transferring files (etc) between devices--notably, between newer Android or Microsoft smartphones and your Debian host.
Be aware that many smarphones will only enable MTP while the phone is not locked!*
GNOME applications (like GNOME_Files and Archive_Manager) use GIO-based GVFS (the GNOME virtual file system) to mount MTP volumes and access files on MTP devices:
Install package gvfs-backends Note: the gvfs-backends version in Debian Wheezy (7.0) may not recognize or mount all devices. Use versions >= 1.15.3.
KDE uses the MTP KIO Slave with a similar level of integration as GVfs.
A graphical tool that is not related to GNOME or KDE is gMTP, install package gmtp
libmtp provides support for MTP devices. Its device support changes with each version of its code, thus you may need a particular version of libmtp (or greater) to support your particular device: e.g., the MotoG phone is not supported directly before libmtp version == 1.1.8 per its maintainers.
Several tools provide a FUSE based file system for mounting MTP devices within the Unix filesystem hierarchy, making it accessible to any program that operates on files and directories. Examples include mtpfs, jMTPFS, go-mtpfs and simple-mtpfs, etc...
install package name=mtp-tools
TODO: document usage, but see below.
Uses FUSE to mount your device's MTP structure into a POSIX filesystem, and fusermount to unmount the device.
install package name=jmtpfs
create
make sure you have write access to
to mount your device: $ jmtpfs
On some MTP devices: your screen must be unlocked in order to mount. However, you might get a (spurious) input/output error even if the screen is unlocked.
to unmount your device: $ fusermount -u
mtpfs has been orphaned since Squeeze, anyway mtpfs is very similar to jmtpfs, except for the executable name, package name, and package status
install package name=mtpfs
to mount your device: $ mtpfs
to unmount your device: $ fusermount -u
Connect your target device (e.g., Android phone) to your Debian host (e.g., laptop) via USB cable, and unlock the target device. Relatively quickly, you should see the following:
Your Debian host's desktop should open a file browser (e.g., a nautilus window) showing the browsable contents of a location. If the location is mounted in your filespace, you should not need to read further from this article. Alternatively, the location will be shown with a URI beginning with mtp://, which will not be mounted, but can be manipulated via the usual means provided by your file browser (including copying and deleting files). If you wish to actually mount that location (i.e., your target device), read on.
If neither of those occur, you should
Check which version of libmtp and associated packages you have installed on your Debian host: see following section=device statuses. Install them if not already done. You will minimally need to have the executable mtp-detect in your path.
Run mtp-detect from your host with your target device attached.
If you see results like
... stop and seek help elsewhere. If you see results like
... your target device is not currently supported. As noted in the result, you should report it to the libmtp maintainers by making a feature request like this one.
If you see results like
then you should be able to mount the target device onto your host's filespace as discussed in the following example.
I have a (working) 1st-generation Motorola MotoG running Android version=4.4.4 that I wish to mount on a Debian laptop. Latter has
Note that libmtp version >= 1.1.8 supports the MotoG per its maintainers. After fiddling with APT and my repositories, I have
With no MTP devices connected to the laptop, I see (from the laptop)
I then unlocked the MotoG's screen and connected it to the laptop with a USB cable.
Immediately upon connecting, a nautilus window opened on the laptop showing the browsable contents of location=mtp://[usb:001,040]/ with device name=XT1028. I can also see (from the laptop)
I can then mount the MotoG's storage with
... and unmount the MotoG's storage with
I initially tried to mount the MotoG using sudo. Don't do that! You'll get results like
Remember: MTP filesystems are implemented as FUSE, which means Filesystem in your Userspace.
First install the mtp-tools package:
Then get the list of available files:
file_list.txt will now contain entries like this:
where 'Parent ID' is something like the folder where the file resides on the smartphone. So you'll want to do something like this to get that particular file:
Yes, the mkdir '12' and the 12 from the Parent ID in the local file is important.
This has been tested with a Lumia 530 with Windows Phone 8.1
Then, to be able to browse the phone in KDE, you need to install 'kio-mtp' package. In jessie it is version 0.75+git20140304 . But with the version in jessie you will face the following issue in Dolphin 'mtp:udi=/org/kde/solid/udev/sys/... does not exist'. To get that fixed, you need to recompile yourself the package with the patch from https://bugs.kde.org/show_bug.cgi?id=325335. I backported that patch and sent it back to that kde bugreport in case someone is interested.
联系客服