Ubuntu Nexus 7 as USB device does not work

I connected USB cable from Nexus 7 running Ubuntu to my Ubuntu laptop but there is no new USB device found when I run lsusb. Is this function supported?


A blog post by Bilal Akhtar has a supposedly more reliable way to connect to Android 4.0+ devices from Ubuntu. The steps are summarized here:

  1. Install the go-mtpfs library, which you'll be using to connect:

    sudo apt-get install golang fuse git-core libmtp-dev libfuse-dev
    sudo adduser $USER fuse
    mkdir /tmp/go 
    GOPATH=/tmp/go go get github.com/hanwen/go-mtpfs
    sudo mv /tmp/go/bin/go-mtpfs /usr/bin/
    mkdir ~/MyAndroid
    

    Note: At some point during installation, a screen may come up in your terminal asking if you want to share information about public Go packages you install with the developers. Feel free to answer this question however you want.

  2. Mount your Nexus 7 or whatever using this command after plugging it into your USB port:

    go-mtpfs ~/MyAndroid &
    
  3. When you are finished, unmount your device by using this command:

    fusermount -u ~/MyAndroid
    

I would also like to thank James Gifford for pointing this article out to me on Google+. ;)


UPDATE Please take a look below for go-mtpfs example. go-mtpfs is much more reliable, but the instructions remain very similar.


Automatically mounting Nexus 7

Allow non-root users to mount fuse devices:

sudo vim /etc/fuse.conf

Un-comment **user_allow_other**.

Install mtpfs

sudo apt-get install mtp-tools mtpfs

Make mount point

sudo mkdir /mnt/nexus7

chown youruser:youruser /mnt/nexus7

Add udev rules

sudo gedit /etc/udev/rules.d/99-android.rules

#Nexus7 
SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"

sudo chmod +x /etc/udev/rules.d/99-android.rules

Add Nexus7 to fstab

sudo vim /etc/fstab

mtpfs /mnt/nexus7 fuse user,noauto,allow_other,defaults 0 0

Restart udev

sudo service udev restart

Access device

mount /mnt/nexus7

umount /mnt/nexus7