[How to] Connect an android device [using MTP] on Linux [Ubuntu 14.04 LTS] 100% working

I recently moved to Linux[Ubuntu 14.04 ] from windows 8.1 because it hangs a lot on my lappy. Apart from the cool features of Ubuntu , one thing was annoying me that I was unable to connect my android phone [Asus zenfone 4 TOOi] and thus was unable to transfer any files via usb using MTP. After searching a lot I finally got the working answer on ubuntuforums.org which I'm again explaining it here again as simply as possible.
First of all you must have an active Internet connection.
Step 1:
First we need to install some necessary tools for MTP detection in Linux[Ubuntu]
open terminal and type the following command

 sudo apt-get install libmtp-common mtp-tools libmtp-dev libmtp-runtime libmtp9

 sudo apt-get dist-upgrade

Sample terminal command
MTP

Step 2:
Now we need to get vender and product ID
For that attach your android MTP device to your Linux system.
Type following command in terminal

lsusb

My output was as follows

Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 026: ID 0b05:580f ASUSTek Computer, Inc.
Bus 001 Device 025: ID 064e:c21c Suyin Corp.
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

 The above one in red color is my device with It's vendor and id("0b05" and "580f")

Step 3:
Now we will amend the mtp udev rules as follows, from a terminal type

Code:

 sudo nano /lib/udev/rules.d/69-mtp.rules


Now, add the following line of code


# Asus Zenfone 4 TOOi
ATTR{idVendor}=="0b05", ATTR{idProduct}=="580f", SYMLINK+="libmtp-%k", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1"




Note: change the vender and product id as of your device(In red color in this post) and you can also change the device name after # as per your wish but it is not necessary.

When you are done editing, save the file(Ctrl+c, then Y and then enter)

Step 4:
The next step would also be to add a line of code to the 51 android rules file, again from a terminal type

Code:

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


Then add the following line of code

Code:

ATTR{idVendor}=="0b05", ATTR{idProduct}=="580f", MODE=”0666"


Remember to change the vender id and product id as per your system(shown in red color)

When you done, save the file.

Step 5:
Type the following code in terminal


 sudo service udev restart


after this, save all your work because we will reboot your system

Step 6:

Type following command to reboot your system

sudo reboot


Detected MTP Device





Additional Optional work:
If you want to work with nice GUI with your MTP device rather than using default file explorer of Ubuntu/Linux
try following command

sudo apt-get install gmtp


or you can also download this from software center.

Popular posts from this blog

[How to] install Remastersys on Unbuntu 14.04 [Linux] with GUI support

RTU B.Tech 4th semester Computer science Syllabus (Common to IT also)