How to Access Android Devices in Linux

27 May , 2012 bill Android

Introduction
If you have an android device that is not recognised when trying to access it via USB, this tutorial should help you. This technique is known to work for Iconia and Xoom tablets and is the result of researching many pages when I was trying to get my A501 tablet communicating via USB with Linux.

In Android
The first thing that needs to be done is to turn on USB debugging on the Android device. This option can be found by going to Settings -> Applications -> Development.

Install Packages
The MTPFS package now needs to be installed. It can be installed with the following command:

sudo apt-get install mtpfs

Device Vendor ID
To get the vendor id, plug in the Android device and use the command:

lsusb

The output should look something like this:

bill@Mint64 ~ $ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 004: ID 0502:3344 Acer, Inc. 
Bus 002 Device 002: ID 04d9:0499 Holtek Semiconductor, Inc. Optical Mouse
Bus 002 Device 003: ID 1532:0109 Razer USA, Ltd Lycosa Keyboard
Bus 002 Device 004: ID 041e:30d3 Creative Technology, Ltd Sound Blaster Play!

In the same line as “Acer, Inc.” you will see the number 0502, that is where you will find the vendor id.

UDEV Rule
Open up nano or any other editor, you can use the following command for nano:

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

Add the following line to the file remembering to use the VendorID that was in the lsusb output where 0502 is:

SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666"

Fuse
The file fuse.conf needs to be modified, uncomment the line user_allow_other. The file can be edited with the following command:

sudo nano /etc/fuse.conf

You have to add your login name to the fuse group. Edit the group file:

sudo nano /etc/group

Look for the line fuse and add your name to it. It should look like this: (I added bill to the line)

fuse:x:104:bill

Mount Point
The mount point can be anywhere and one that exists can be used. To create one in the “mnt” directory use the following commands: (use your username where bill is)

sudo mkdir /mnt/a501
sudo chown bill:bill /mnt/a501

Mounting
The mount point can be added to fstab but I have created a small script to mount the drive and display the directory. If you are not using nautilus you need to change that line and if the mount point is not going to be /mnt/a501, that needs to be changed as well.

#!/bin/bash
gksu -S --message "Enter your password to mount your Android device." "mount mtpfs /mnt/a501 -t fuse -o user,noauto,allow_other"
nautilus /mnt/a501/

android, bash, how to, linux, script,

22 Responses to “How to Access Android Devices in Linux”


Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress. Designed by elogi.