Galaxy Nexus and Ubuntu 10.04 – MTP

See the previous article about Ubuntu 10.04 and Galaxy Nexus. In one of the links listed there there are some explanations on why do we need this new MTP (Media Transfer Protocol) stuff instead of our good-old USB mass storage style.

In order to have the Galaxy Nexus recognized by Ubuntu 10.04 we have to rebuild libmtp and mtpfs from newer sources and this is how I did it. While those are not exactly copy-paste instructions they are good enough for an experienced user:

  • download the latest libmtp from sourceforge.
  • remove old mtp stuff
    sudo dpkg --purge mtp-tools mtpfs libmtp8
  • install some build prequisites
    apt-get install libusb-dev
  • build and install, i’m using checkinstall tool instead of the the simple make install in order to have a dpkg package:
    ./configure --prefix=/usr; make; sudo checkinstall

If all went ok, you may nou use the mtp-detect command to see if you device is recognized when connected. And proceed with mtpfs:

  • get the sources
    svn checkout http://mtpfs.googlecode.com/svn/trunk/ mtpfs-read-only
  • install some build prerequisites
    sudo apt-get install libid3tag0-dev libmad0-dev libglib2.0-dev libfuse-dev
    sudo apt-get install automake autoconf
  • build and install it:
    aclocal; autoconf; automake -a
    ./configure; make; sudo checkinstall

Then, check the file /etc/fuse.conf for a single line containing:

user_allow_other

Now, for the final trick:

  1. disable USB debugging on your phone
  2. connect the cable
  3. and run
mtpfs -o allow_other SOME-EXISTING-EMPTY-DIRECTORY

If everything is ok, you’ll see under that directory the content of the phone and you can manipulate the files there (hint: rsync backup). To umount the directory, use this command:

fusermount -u THAT-DIRECTORY

Yeah, I know it’s ugly like hell and the previous USB mass storage was so nice and easy but hopefully the next versions of Ubuntu will make this article obsoleted and the things will work again by default.

 

 

 

 

 

 

 

 

 

android ICS screenshots

Unless you need something very special, a screenshot application is no longer needed in the new Android 4.x. Just press VolDown + Power hardware buttons and voila, your screenshot is in the gallery ;-)

Google, we’re still waiting for screencasts!

 

 

Galaxy Nexus and Ubuntu 10.04 – adb

This combination is not working by default, there is work to be done. But first, why I’m using Ubuntu 10.04 and not upgrading? Because 10.04 is long term support (LTS) and for me stability is more important than features, even on desktop/laptop.

I have finally succeeded to see my Galaxy Nexus when connected with USB cable but it wasn’t easy. Here are some links that helped me:

  • http://www.omgubuntu.co.uk/2011/12/how-to-connect-your-android-ice-cream-sandwich-phone-to-ubuntu-for-file-access/
  • http://ohheyitslou.blogspot.com/2011/12/galaxy-nexus-enable-mtp-file-transfer.html
  • https://answers.launchpad.net/ubuntu/+source/util-linux/+question/183144
  • http://www.reddit.com/r/Android/comments/ne6ud/mount_your_new_galaxy_nexus_from_the_unity/

The first step is to have adb (Android debug interface) working. In case you didn’t have already installed adb, you’ll have to do it:

  • http://forum.xda-developers.com/showpost.php?p=10746225&postcount=1
  • or search google install adb ubuntu

When you connect the Galaxy Nexus with the USB cable and run adb devices you’ll something with many question marks. This can be easily repaired by adding a line to udev rules: edit (as root or with sudo) the file /etc/udev/rules.d/99-android.rules and add

SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="plugdev"

then restart udev (sudo service udev restart).  Now, pay attention:

  1. run adb kill-server
  2. pull the phone out
  3. on the phone, under settings, developer options, tick USB debugging
  4. insert the cable again
  5. run adb devices

If everything is ok, you should see your phone listed WITHOUT ?????:

 adb devices
 * daemon not running. starting it now on port 5037 *
 * daemon started successfully *
 List of devices attached
 01498B3016013017    device

Why is all this adb stuff usefull? Just run adb help and you’ll see:

  • adb shell ls -la # list files
  • adb push <local> <remote> # copy file/dir to device
  • adb pull <remote> [<local>] # copy file/dir from device
  • adb install file.apk # push this file and install it (how can you otherwise do this if you don’t have a file manager and the market isnt setuped yet?)

In the next article I’ll describe how I have managed to setup MTP, but until then you can start copying files with adb push/pull ;-) One last thing here, I wonder if a fuse-adb would be usefull.