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.

[IMPORTANT UPDATE - May/3/2011]

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. :-(

8 comentários:

Oliver vBK disse...

I think it would be better to not just use the vendor id on the udev rules file. It is better to add the xoom's device id, or else every motorola device should be mounted with mtpfs.. or at least it will try.

Eduardo Otubo disse...

Oliver,

You're right. But in my case, I have just one Motorola device, so I don't need to set the device id. But anyway, I'll correct the post and put both vendor and device ids to avoid further problems :)

Thanks for the feedback!

Rodrigo Haydt disse...

Fugindo do assunto...está gostando do brinquedo? Abraços!

Eduardo Otubo disse...

@Haydt,

O aparelho é realmente muito bom, hardware não deixa nada a desejar, talvez apenas um pouco pesado, mas de resto achei muito bom.

O software é que acho que está no comecinho, acredito que ainda tenha um bom caminho pra percorrer com app específicas para tablets e otimizações de tamanho de tal. Vamos ver no que da :)

Aparece aqui em casa qualquer dia pra dar uma olhada!

[]'s

Vegetando disse...

Segui o tutorial e funcionou. Valeu. :)

Só um detalhe (que não sei se é ou não relevante para todos os casos), no meu caso a montagem do xoom só deu certo depois de habilitar o modo de depuração USB. Antes disso só dava a mensagem de "Transport endpoint is not connected", já usando o 11.04.

Herli Joaquim de Menezes disse...

Diz uma coisa, há alguma particularidade para a distro Fedora? Segui os passos, usando o yum, aparentemente ok. O dispositivo é reconhecido no lsusb, mas o Dolphin (uso KDE4.x)não o vê. Alguma solução?

Eduardo Otubo disse...

@Herli,

Mas você consegue montar normalmente? O problema está apenas no dolphin?

Herrmann disse...

Comigo aconteceu exatamente o mesmo que aconteceu com o vegetando.
Usando Ubuntu 10.10 e instalando as bibliotecas do proprio repositório do Ubuntu. Fiz tudo até o passo 7 e só funcionou quando ativei o modo depuração USB.

No entanto, para montar tive que utilizar a linha de comando:
mtpfs /media/xoom -o allow_other

E para desmontar o comando:
sudo fusermount -u /media/xoom

Valeu pela excelente dica.