Monday, March 26, 2012

Connecting Samsung Galaxy Tab 7.0 Plus to Ubuntu using MTP

Thanks to Terence Eden's note "Connecting Samsung ICS to Ubuntu using MTP". I tried this for Samsung Galaxy Tab 7.0 Plus GT-P6210 which has Android 3.2 with Ubuntu 11.10. Since Android is moving away from USB Mass Storage, we will no longer be able to plug in a USB cable and have our Android show up as a USB disk with Ubuntu. So we need to install MTP tools and set it up for MTP data transfer.

(1) Install the MTP tools.
sudo apt-get install mtp-tools mtpfs

Connect the device to the computer using USB.

To check that MTP is installed and working, run the command

mtp-detect

You should see a spool of text as MTP detects the tablet.

(2) To create the rules which allow Ubuntu to detect the tablet, create a new rule file like so:

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

Add in this line of text

SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666"

If you’re using a different device, run this command to get the correct idVendor and idProduct:

mtp-detect | grep idVendor
mtp-detect | grep idProduct

(3) Restart udev so it can pick up the new rule.

sudo service udev restart

(4) Create a directory in your filesystem which you can use to access the tablet.

sudo mkdir /media/Galaxy7
sudo chmod a+rwx /media/Galaxy7

(5) Add ourselves to fuse.
sudo adduser YOURUSERNAME fuse
sudo emacs /etc/fuse.conf

The last line probably reads
#user_allow_other


Remove the “#” so you’re left with:
user_allow_other


Save the file.

(6) Create two commands “android-connect” and “android-disconnect”. When run, these will allow you to connect to your phone, then safely disconnect.

echo "alias android-connect=\"mtpfs -o allow_other /media/Galaxy7\"" >> ~/.bashrc
echo "alias android-disconnect=\"fusermount -u /media/Galaxy7\"" >> ~/.bashrc
source ~/.bashrc

(7) Turn OFF USB debug mode if it is ON

(8) Open your file manager and go to “/media/Galaxy7”, open a terminal, and connect the tablet to the Ubuntu computer via USB and run

android-connect

Without opening file manager and showing “/media/Galaxy7”, it may not work. Different orders also affect the mounting.

Once you’re done, disconnect the device by running

android-disconnect

Followers

Blog Archive

About Me

My photo
HD Multimedia Technology player