segunda-feira, 25 de abril de 2011

Using mtpfs as storage device with Motorola Xoom and Ubuntu

Meta info: No, I am certainly not going to make review for this device. For this sort of content you can find tons of information on the web, one better than another. My post would be yet another in this sea of information :-) INSTEAD, let's learn how to mount it as "mass storage device" on Ubuntu Maverick.

(default image for this post :P)

This tutorial is needed because the new Android version (3.0 aka Honeycomb) DOES NOT support mass storage device YET. It uses MTP (Media Transfer Protocol). This is not bad at all! In fact, the transfer rates are pretty faster than in usual mount as mass storage.

The procedure is pretty straightforward, I found a complete guide on XDA developers forum, which I'll describe here in short words:

1) Install mtpfs package on Ubuntu:
otubo@vader ~ $ sudo apt-get install mtpfs

2) Create new rules in udev for the Xoom:
otubo@vader ~ $ cat > /etc/udev/rules.d/51-android.rules
SUBSYSTEM=="usb", SYSFS{idVendor}=="22b8", SYMLINK+="libmtp-%k", MODE="0666"

3) Create the mount point and make it yours:
otubo@vader ~ $ sudo mkdir /media/xoom
otubo@vader ~ $ sudo chown otubo:otubo /media/xoom

4) Configure your /etc/fstab to mount it automatically by adding this line:
mtpfs /media/xoom fuse user,noauto,allow_other 0 0

5) Uncomment the option user_allow_other on the fuse configuration file at /etc/fuse.conf

6) Add yourself to the fuse group.

7) Reboot, plug your Xoom in and click "xoom" on the "Places" menu on your Ubuntu. Simple as that :)

BUT, if you face any problems, like "Transport endpoint is not connected", you may need to reinstall mtpfs from a different version. This sort of error is a bug on mtpfs, it segfaults when trying to mount/access it. So I installed from Natty's repository and everything worked fine :) BUT, if you're reading this post after the Natty's release, you probably won't need to worry about this.


Later on I figured out that even with Natty's version of the mtpfs I was getting a segfault when trying to mount/access the device. So, I downloaded the source code from the maintainer's page, compiled and now EVERYTHING is working pretty fine. Thank God :) It's important to notice that the segfault is on the mtpfs package and not in libmtpfs (which I also tried to uninstall and install from source). If you need to mess with your system (install from source and not from repository) always try to mess as little as possible :)

[IMPORTANT UPDATE 2 - same day]

I got a segfault AGAIN. Trying to reproduce all the steps I figured out that I had to REBOOT my Motorola Xoom to make it work with the same setup. Looking forward to have a CyanogenMod ROM for my device. Sigh. :-(