Well, since I do not really get it, why the Android firmwares got the mass-storage usb functionality removed (OK, locking the device exclusively is not good, but hey, if I activate storage, I want just storage, right?) instead using Media Transfer Protocol (MTP), this kills usability on Linux not natively supporting this for now. Since I refuse to just boot another OS for using my Galaxy SIII or now even Nexus 7 in order to copy data to it, this needs to be done the hard way. You might figure that there are possible workarounds with ftp/ssh servers or AirDroid, but this would make USB useless, having a bit more speed advantage after all.

Using Debian Sid over here, should work on Wheezy as well. Note: The jmtpfs described here is broken, make fails on getgid() calls, probably some header includes are wrong, but I won’t debug that.

Note: Since libmtp will not identify the newer Nexus 7, we will need to install the latest libmtp ourselves (Debian sid still ships 1.1.3). Note: I will install to /usr/local/bin/ avoiding collision with existing package installs.

Second Note: You can install the latest tarball 1.1.5 release, as Nexus 7 support was added in the latest release. Newer devices like Nexus 4 are in git only so let’s just install latest HEAD. See e.g. this bug entry. Check src/music-players.h in your source tree (or git here) if your device is already supported.

$ apt-get install git-core build-essential
$ git clone git://git.code.sf.net/p/libmtp/code libmtp-code
$ cd libmtp-code
$ sh autogen.sh
$ ./configure --prefix=/usr/local
$ make
$ sudo make install

Important: Copy the udev rules first before proceeding! Otherwise your USB plugged device won’t be recognized as such.

$ sudo cp 69-libmtp.rules /etc/udev/rules.d/

Reboot. Otherwise udev won’t load the new ruleset for recognizing the device properly.

$ sudo apt-get install golang fuse git-core libmtp-dev libfuse-dev
$ sudo adduser $USER fuse
$ mkdir ~/tools/go-mtpfs
$ GOPATH=/home/dnsmichi/tools/go-mtpfs go get github.com/hanwen/go-mtpfs
$ sudo cp ~/tools/go-mtpfs/bin/go-mtpfs /usr/local/bin/
$ sudo chmod a+x /usr/local/bin/go-mtpfs

$ sudo mkdir /media/Nexus7
$ sudo chmod 777 /media/Nexus7

Important: Fuse does not allow to access file systems to others other than the user having mounted it by default. Re-enable that one with

$ sudo chmod a+r /etc/fuse.conf
$ sudo vim /etc/fuse.conf
# Allow non-root users to specify the allow_other or allow_root mount options.
user_allow_other

If required, reboot once more.

Now, mount the filesystem.

$ go-mtpfs /media/Nexus7
2013/01/27 14:37:10 compiled against libmtp 1.1.5
Device 0 (VID=18d1 and PID=4e41) is a Google Inc (for Asus) Nexus 7 (MTP).
2013/01/27 14:37:10 found device Google Inc (for Asus): Nexus 7 (MTP) (18d1:4e41) @ bus 5, dev 2
:
Android device detected, assigning default bug flags
2013/01/27 14:37:10 storage ID 65537: Interner Speicher
2013/01/27 14:37:10 backing data /tmp/go-mtpfs338939414
2013/01/27 14:37:10 starting FUSE unknown

$ ls /media/Nexus7/Interner Speicher/
Alarms/  Android/  DCIM/  Download/  Movies/  Music/  Notifications/  Pictures/  Podcasts/  Ringtones/

Look, how beautiful 🙂

nexus7_gomtpfs

If you’re done and want to safely unmount, just call

$ umount /media/Nexus7

Anyhow, this method requires a lot of compiling, hacking and may not be upgrade safe after all. Likely, you prefer the easy way.

%d bloggers like this: