Difference between revisions of "MTP"
PIMPinator (talk | contribs) (→Installation) |
(→Workarounds for Android) |
||
(30 intermediate revisions by 18 users not shown) | |||
Line 1: | Line 1: | ||
− | [[Category:Sound | + | [[Category:Sound]] |
− | |||
− | |||
− | |||
− | |||
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 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. | ||
− | |||
==Installation== | ==Installation== | ||
MTP support is provided by the [http://libmtp.sourceforge.net/ libmtp] package, to install: | MTP support is provided by the [http://libmtp.sourceforge.net/ libmtp] package, to install: | ||
− | + | pacman -S libmtp | |
− | + | ==Usage== | |
− | + | After installation, you have several mtp tools available. | |
− | mtp- | + | Upon connecting your MTP device, you use: |
− | + | mtp-detect | |
+ | to see if your MTP device is detected. | ||
+ | |||
+ | To connect to your MTP device, you use: | ||
+ | mtp-connect | ||
+ | |||
+ | If connection is successful, you will be given several switch options in conjunction with 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, | ||
+ | {{Note | Some commands may be harmful to your MTP device!!! }} | ||
+ | |||
+ | mtp-albumart mtp-emptyfolders mtp-getplaylist mtp-reset mtp-trexist | ||
+ | mtp-albums mtp-files mtp-hotplug mtp-sendfile | ||
+ | mtp-connect mtp-folders mtp-newfolder mtp-sendtr | ||
+ | mtp-delfile mtp-format mtp-newplaylist mtp-thumb | ||
+ | mtp-detect mtp-getfile mtp-playlists mtp-tracks | ||
==Using media players== | ==Using media players== | ||
− | You can also use your mtp device in music players such as | + | 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: | To do this run: | ||
− | + | $ lsusb | |
and look for your device, it will be something like: | and look for your device, it will be something like: | ||
− | + | Bus 003 Device 011: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II], GT-P7500 [Galaxy Tab 10.1] | |
in which case the entry would be: | in which case the entry would be: | ||
− | + | SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666" | |
+ | Then, reload udev rules: | ||
+ | # udevadm control --reload | ||
{{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.<br> It's available in the community repository; you can install it by running {{ic|pacman -S mtpfs}}. |
+ | *First edit your {{ic|/etc/fuse.conf}} and uncomment the following line: | ||
+ | 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 | |
+ | Also, you can put them into your ~/.bashrc: | ||
+ | alias android-connect="mtpfs -o allow_other /media/YOURMOUNTPOINT" | ||
+ | alias android-disconnect="sudo umount /media/YOURMOUNTPOINT" | ||
+ | {{Note|if you want not be asked for password when using sudo, please refer to [[USB Storage Devices#Mounting USB devices]]}} | ||
+ | |||
+ | ==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 positiv results one should try {{aur|go-mtpfs-git}} from the [[AUR]]. | ||
+ | The following has been tested on a Samsung Galaxy Nexus GSM. | ||
+ | |||
+ | As in the section above install {{aur|android-udev}} which will provide you with "/etc/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 working on native MTP support for gvfs. Currently gvfs uses gphoto2 for mounting MTP volumes. The weaknesses of gphoto2 and mtpfs are listed in his [http://intr.overt.org/blog/?p=153 blog post]. | ||
+ | *You can test his native mtp implementation for gvfs before it gets upstream with the AUR package [https://aur.archlinux.org/packages.php?ID=62664 gvfs-mtp-git]. | ||
+ | |||
+ | *Devices will have gvfs paths like this | ||
+ | gvfs-ls mtp://[usb:002,013]/ | ||
+ | |||
+ | ==KDE MTP KIO Slave== | ||
+ | There is a MTP KIO Slave built upon libmtp under development by Philipp Schmidt, availiable as AUR package [https://aur.archlinux.org/packages.php?ID=63140 kio-mtp-git]. | ||
+ | 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 | ||
+ | |||
+ | Change the line | ||
+ | Exec=kioclient exec mtp:udi=%i/ | ||
+ | To | ||
+ | Exec=dolphin "mtp:/" | ||
+ | |||
+ | ==Workarounds for Android== | ||
+ | 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. | ||
+ | * Samba - an Android app to share your SD card as a windows fileshare. Pros: Your desktop apps work as before (since the SD card appears as a windows fileshare). Cons: you need to root your phone. |
Revision as of 22:18, 24 November 2012
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.
Contents
Installation
MTP support is provided by the libmtp package, to install:
pacman -S libmtp
Usage
After installation, you have several mtp tools available. Upon connecting your MTP device, you use:
mtp-detect
to see if your MTP device is detected.
To connect to your MTP device, you use:
mtp-connect
If connection is successful, you will be given several switch options in conjunction with 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,
mtp-albumart mtp-emptyfolders mtp-getplaylist mtp-reset mtp-trexist mtp-albums mtp-files mtp-hotplug mtp-sendfile mtp-connect mtp-folders mtp-newfolder mtp-sendtr mtp-delfile mtp-format mtp-newplaylist mtp-thumb mtp-detect mtp-getfile mtp-playlists mtp-tracks
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:
$ lsusb
and look for your device, it will be something like:
Bus 003 Device 011: ID 04e8:6860 Samsung Electronics Co., Ltd GT-I9100 Phone [Galaxy S II], GT-P7500 [Galaxy Tab 10.1]
in which case the entry would be:
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666"
Then, reload udev rules:
# udevadm control --reload
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.
It's available in the community repository; you can install it by running pacman -S mtpfs
.
- First edit your
/etc/fuse.conf
and uncomment the following line:
user_allow_other
- To mount your device
# mtpfs -o allow_other /media/YOURMOUNTPOINT
- To unmount your device
$ umount /media/YOURMOUNTPOINT
Also, you can put them into your ~/.bashrc:
alias android-connect="mtpfs -o allow_other /media/YOURMOUNTPOINT" alias android-disconnect="sudo umount /media/YOURMOUNTPOINT"
go-mtpfs
If the above instructions don't show any positiv results one should try go-mtpfs-gitAUR from the AUR. The following has been tested on a Samsung Galaxy Nexus GSM.
As in the section above install android-udevAUR which will provide you with "/etc/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 working on native MTP support for gvfs. Currently gvfs uses gphoto2 for mounting MTP volumes. The weaknesses of gphoto2 and mtpfs are listed in his blog post.
- You can test his native mtp implementation for gvfs before it gets upstream with the AUR package gvfs-mtp-git.
- Devices will have gvfs paths like this
gvfs-ls mtp://[usb:002,013]/
KDE MTP KIO Slave
There is a MTP KIO Slave built upon libmtp under development by Philipp Schmidt, availiable as AUR package kio-mtp-git. 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
Change the line
Exec=kioclient exec mtp:udi=%i/
To
Exec=dolphin "mtp:/"
Workarounds for Android
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.
- Samba - an Android app to share your SD card as a windows fileshare. Pros: Your desktop apps work as before (since the SD card appears as a windows fileshare). Cons: you need to root your phone.