There are two players in the modern smartphone arena as I see it. Apple and Samsung. I’d like to say Apple IOS and Google Android but it’s really only the very top end Android handsets that can honesty compete with the bespoke slickness of Apple’s IOS for one very good reason – the consistent hardware platform underneath IOS makes it easier for Apple to “get it right”.
I don’t buy into Apple’s walled garden because I choose to operate my devices one layer down from the top Application layer whenever possible. By that I mean that I use the command line in preference to an over simplified or over complicated and wholly unnecessary graphical user interfaces, and not for some kind of geek badge of honour but purely for speed of results. In fact the only gui I can’t live without is a decent file manager such as KDE’s Dolphin. I say can’t live without. I could live without it actually. Hmm.
Anyway, the reason for this post is to provide an answer to the one annoying feature of Samsungs Android phones when connecting them to a PC running Linux via the USB cable. I don’t expect it of Apple, but I do expect it of Samsung and that is automatic mounting of the internal storage devices using standard protocols. Android is Linux, Linux is Linux. When I plug in my Note 3, I absolutely do not expect to be given a choice of presenting the storage via Microsofts MTP protocol or as a camera whereby only jpg files show up. Grrrr. That really grips my, well you can see why right? Just mount the damn thing like a USB storage device for goodness sake! Microsoft protocols have absolutely no place here.
The open source community has already come to the rescue with the requisite packages to mount an MTP device into the Linux filesystem – mtpfs and mtp-tools. It’s a little bit back to front but it gets the job done without having to mess about with the phone’s functionality.
1. Install mtp filesystem support and tools using the commands numbered 39 through 43 in my history shown below…
2. Connect the phone via the usb cable and run mtp-detect
3. Write a udev rule to handle mounting of the phone’s specific MTP device automatically when connected via USB in future.
4. Relax and enjoy automatic mounting of the phones MTP device as if it were mounting the internal storage as a regular USB storage device!
Use the VID and PID (Vendor and Product ID) to construct the udev rule /etc/udev/rules.d/51-android.rules as shown below, then restart udev.
[paypal-donation]
Hi
Thanks for the instructions. Straightfoward to follow. Unfortunately, I’m still getting error messages. mtp-detect finds the device, but can’t connect. I have a Note 2, and my id numbers were actually exactly the same as yours. I get the output below using mtp-detect or when entering the allow_other line.
Unable to open ~/.mtpz-data for reading, MTPZ disabled.libmtp version: 1.1.6
Listing raw device(s)
Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).
Found 1 device(s):
Samsung: Galaxy models (MTP) (04e8:6860) @ bus 3, dev 14
Attempting to connect device(s)
ignoring libusb_claim_interface() = -6PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device
outep: usb_get_endpoint_status(): Resource temporarily unavailable
libusb_open() failed!: No such file or directory
LIBMTP PANIC: Could not init USB on second attempt
Unable to open raw device 0
The phone pops up in notications when connected, but clicking on mount does nothing, and opening Dolphin via the notification brings up a folder that fails to connect.
I’ve done a fair bit of tinkering in trying to solve this. Do you know what mtp related packages should currently be installed? I am using Kubuntu 14.04. I can access pictures fine via PTP. Any pointers would be great!
Thanks
Rob
mtpfs and mtp-tools are the only packages I had to install on Xubuntu. Kubuntu and a Note 2 are obviously proving to be a bit more of a challenge.
Make sure you’ve not got any hotspot or usb tethering enabled at the same time. If the VID and PID of the device is correct, and you’ve restarted the mtp daemon, then it should just mount.
The only other thing I’d make sure of is that Kubuntu 14.04 doesn’t already support it in some way, and your udev rule is conflicting with Kubuntu attempting to mount it in its own way. I say this because I’m using the latest XFCE version of Linux Mint and it supports it out of the box, but does take a little time to mount it ready for use – which can lead to an impatient person like me to believe it doesn’t support it.
If you get it working, however you do it, it’d be great if you could feed back so others may benefit.
Thanks for the reply Matt. I played around a bit more, went into Synaptic, looked for anything MTP related and kept trying. I got to a point where I could view and navigate my phone – card and internal storage – but I couldn’t copy anything to it, and the connection seemed very flaky.
For info, I did try a lot of things before messing with udev, so I don’t think there was any conflict.
I don’t have another cable to try, so I can’t discount that yet. I’m going to try the Alpha of Kubuntu 14.10, and a couple of other live images I have from other distros, see how it goes. Cheer again.
Alphas? Don’t waste too much time on it. Linux Mint XFCE or if you must, there’s the KDE version. Good luck. It might be your cable.
Thank you. when i tried to come by similar advice about mounting an iphone it was hard to come by suprisingly. This was really simple and straightforward.
Thank you for your help.
Regrads, Paul
Glad you found it and it helped. You’re welcome.
-Matt