13

I can connect my Galaxy Nexus to my Kubuntu machine using the PTP protocol, but it's really slow. I've read this interview about why Galaxy Nexus doesn't support USB Mass storage, and I've gone to http://www.android.com/filetransfer/ as instructed but there's no way I can see which will allow me to connect to the device using a linux machine and MTP.

Does anyone know how to get MTP, or any other protocol, working?

9 Answers 9

7

You could also try mtpfs or gMTP. mtpfs allows to mount the MTP device as a filesystem, while gMTP is a standalone program.

Over at AskUbuntu there's an answer that shows how to use mtpfs.

2
  • gMTP seems to work very nicely for me to copy photos over from my old phone. Trying to copy over PTP was painful.
    – Ryan
    Commented Dec 8, 2011 at 8:18
  • 1
    gMTP is unsatisfactory for me. It is VERY slow and it gives errors with music files (it tries to create albums for every file transferred). gMTP also crashes frequently in Ubuntu. I like the ADB method better. I also use SSHFS over WiFi and a few other methods.
    – MountainX
    Commented Apr 22, 2012 at 17:35
6

I'll expand idea of Ryan Conrad:

adb from android-tools is the way.

I prefer to follow this guide to install Eclipse with android-sdk:

http://developer.android.com/sdk/installing.html

Installation depends only on JDK. No installing of new packages. I personally do the same few steps (=extracting two folders anywhere and configuring eclipse) in the same manner on Ubuntu, Mint or Debian distributions and all is just working.

After completing this classical guide I have two new folders: eclipse and android-sdks. In the android-sdks folder ./platform-tools/adb is the path to adb tool, which can be used to push (upload) and pull (get) files from android device—without mtpfs or additional mounts.

As adb is command-line program, it can be automated in a jiffy. Moreover, you have Eclipse's File Explorer view, which provides nice graphical tree filestructure and basic drag-and-drop interface (do not forget to select your device in the Devices view first!).

The big shortcoming of this method is that only adb tool sees the device and can access it. The rest of my system, including Nautilus for example, still not sees the device. But after getting used to stability and robustness of adb that's not the issue for me.

3
  • 1
    adb is a security problem if you keep it enabled constantly. Keep in mind that there's no passphrase dialogue or anything. One can bypass screen locks and even full device encryption. Especially if you happen to charge it at unknown locations (PC in internet cafe, etc.)
    – ce4
    Commented Jul 9, 2012 at 20:36
  • thanks for notice, ce4. Let me ask then: what means to access android storage should we use in unknown locations?
    – Fyodor
    Commented Jul 10, 2012 at 15:28
  • 1
    added own answer about bluetooth :-)
    – ce4
    Commented Jul 10, 2012 at 16:25
6

You can use bluetooth.

Bluetooth FTP (file transfer profile) is supported by Linux and there's the Bluetooth File Transfer app that adds this functionality to android. It's however not that fast (<200kb/s) depending on your bluetooth versions. –

There's a fuse module called obexfs, here's my Nexus S mounted:

root@local:/tmp# obexfs -b f0:08:f1:xx:xx:xx -- /media/bla
root@local:/tmp# cd /media/bla
root@leo61326:/media/bla# ls -lh /media/bla/DCIM/
total 5,5K
drwxr-xr-x 1 root root    0 2012-05-25 16:09 100ANDRO
drwxr-xr-x 1 root root    0 2012-07-05 17:31 2012-06-09_Rafting
drwxr-xr-x 1 root root    0 2012-07-09 22:30 Camera

Some file explorers support it via plugins directly (nautilus/gnome/kde/...) Here are some Ubuntu related obex questions.

2
  • 1
    This answer deserves more upvotes - I couldn't get either MTP or PTP to work well with my Kubuntu install. Commented Feb 20, 2013 at 19:56
  • It'll hopefully get better with newer Ubuntu releases. I'm really confident about this. I mostly use ADB on the commandline (which I use a lot), so this is the fastest path for me right now. I also use "bluetooth-sendto some-file" sometimes.
    – ce4
    Commented Feb 21, 2013 at 10:53
3

You could use adb and transfer using the adb pull/push commands.

Not sure of what distro of linux you are using, but I found this that says MTP is packaged and available for ubuntu though a package called mtp-tools.

Also note that this is not specific to android 3.x/4.x, this is true for any devices that run 3.x/4.x that lack an external sdcard. If the device has an sdcard slot, you will be able to mount the device like in previous versions of android.

2

mpfs is a FUSE based file-system that can mount the Nexus on your system.

mtpfs -o allow_other /media/MOUNTPOINT

Will mount it for you. To unmount simply umount /media/MOUNTPOINT

0

Another option is WebDAV.

Setting up an Android WebDAV server

On my stock Nexus 7, I installed WebDAV Server, opened it, clicked on the start button and was immediately able to see my /storage/sdcard folder in my web browser at the URL displayed by the application, i.e. http://192.168.x.y:8080

Note that with WebDAV Server, you also have the option of selecting Root (/) or DCIM as well as SdCard as the WebDAV root.

Using the WebDAV server via Nautilus

In Nautilus I selected "Connect to server..." from the File menu, selected "WebDAV (HTTP)", entered 192.168.x.y as the server and 8080 as the port and clicked on Connect.

Navigating through the directory hierarchy is slower than accessing other network shares, but not unreasnable. Copying a single 42MB file via Nautilus took around 12 seconds, so 3.6MB/s.

Mounting a WebDAV drive from the command line

I installed davfs2 and mounted my share as /mnt using the command:

sudo mount -t davfs http://192.168.x.y:8080 /mnt

Copying the same 42MB file but with more precise timing, took 12.88s or 3.24MB/s.

$ time cp music.fsb /tmp

real    0m12.880s
user    0m0.002s
sys     0m0.143s

Caveats

  • WebDAV access is not secure. Even if you set a password on the WebDAV share, the connection is still http not https, so it is not encrypted. Only use WebDAV on a secure wifi network and certainly don't enable the WebDAV server while you are in an internet cafe or other unsecured wifi.
0

You can use the FTP protocol at usb cable speed with this app (not that it requires having adb, but after you've set up adb connecting/transferring is quick and painless, and you can even view the files in your favorite file manager.

https://play.google.com/store/apps/details?id=com.theolivetree.ftpserver

instructions are in the play store description.

0

Working MTP on Ubuntu for Galaxy Nexus, Nexus 7 and Acer A500 Where to start.

I found some instructions for the Nexus 7 (which I had just brought) on this site Ubuntu 12.04 - Automount Nexus 7 in MTP mode. All credit to the author of that page for figuring it out. The instructions i have below come from this site, are trimmed to the commands, if you want more explanation see the above site.

I used Ubuntu 12.10, and have configured for my Nexus 7, Galaxy Nexus and Acer A500. Instructions

Configure FUSE

Change /etc/fuse.conf so its read by all..

# sudo chmod a+r /etc/fuse.conf

Edit /etc/fuse.conf to remove the comment # from user_allow_other so the default fuse.conf will look like

# Set the maximum number of FUSE mounts allowed to non-root users.
# The default is 1000.
#
#mount_max = 1000

# Allow non-root users to specify the 'allow_other' or 'allow_root'
# mount options.
#
user_allow_other

Compile and install go_mtp

# sudo apt-get install libmtp-dev golang 
# mkdir /tmp/go
# export GOPATH=/tmp/go
# go get github.com/hanwen/go-mtpfs
# sudo mv /tmp/go/bin/go-mtpfs /usr/local/sbin/go-mtpfs
# sudo chmod a+x /usr/local/sbin/go-mtpfs

Create Mount Point(s)

Use the following as you need..
# sudo mkdir /media/Nexus7
# sudo chmod 777 /media/Nexus7
# sudo mkdir /media/GalaxyNexus
# sudo chmod 777 /media/GalaxyNexus
# sudo mkdir /media/A500
# sudo chmod 777 /media/A500

Setup udev rules

Use your favourite editor and create the following file (remove any other android udev rules you might have experimented with first).

# sudo vi /etc/udev/rules.d/99-android.rules

Paste in the following contents. you can remove rules you don't need, The two nexus devices appear to have the same ids for the bootloader and recovery. NOTE: you need to replace #YOURLOGIN# with your username/login.

# Google Nexus 7 & Galaxy Nexus 16 Gb Bootloader & recovery mode
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0666" # Bootloader
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d001", MODE="0666" # Recovery

# Google Nexus 7 16 Gb PTP mode (camera)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e43", MODE="0666" # PTP media
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e44", MODE="0666" # PTP media with USB debug on

# Google Nexus 7 16 Gb MTP mode (multimedia device)
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e41", MODE="0666" # MTP media
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0666" # MTP media with USB debug on

# Google Nexus 7 MTP mode : automatic mount when plugged
ENV{ID_MODEL}=="Nexus_7", ENV{ID_MODEL_ID}=="4e41", ACTION=="add", RUN+="/usr/bin/sudo -u #YOURLOGIN# /usr/local/sbin/go-mtpfs -allow-other=true /media/Nexus7"
ENV{ID_MODEL}=="Nexus_7", ENV{ID_MODEL_ID}=="4e42", ACTION=="add", RUN+="/usr/bin/sudo -u #YOURLOGIN# /usr/local/sbin/go-mtpfs -allow-other=true /media/Nexus7"

# Google Nexus 7 MTP mode : automatic unmount when unplugged
ENV{ID_MODEL}=="Nexus_7", ENV{ID_MODEL_ID}=="4e41", ACTION=="remove", RUN+="/bin/umount /media/Nexus7"
ENV{ID_MODEL}=="Nexus_7", ENV{ID_MODEL_ID}=="4e42", ACTION=="remove", RUN+="/bin/umount /media/Nexus7"


# Google Galaxy Nexus 16 Gb Bootloader & recovery mode
#SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e40", MODE="0666" # Bootloader
#SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="d001", MODE="0666" # Recovery

# Google Galaxy Nexus 16 Gb PTP mode (camera)
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6865", MODE="0666" # PTP media
#SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="4e44", MODE="0666" # PTP media with USB debug on

# Google Galaxy Nexus 16 Gb MTP mode (multimedia device)
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="685c", MODE="0666" # MTP media
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666" # MTP media with USB debug on

# Google Nexus 7 MTP mode : automatic mount when plugged
ENV{ID_MODEL}=="Galaxy_Nexus", ENV{ID_MODEL_ID}=="685c", ACTION=="add", RUN+="/usr/bin/sudo -u #YOURLOGIN# /usr/local/sbin/go-mtpfs -allow-other=true /media/GalaxyNexus"
ENV{ID_MODEL}=="Galaxy_Nexus", ENV{ID_MODEL_ID}=="6860", ACTION=="add", RUN+="/usr/bin/sudo -u #YOURLOGIN# /usr/local/sbin/go-mtpfs -allow-other=true /media/GalaxyNexus"

# Google Nexus 7 MTP mode : automatic unmount when unplugged
ENV{ID_MODEL}=="Galaxy_Nexus", ENV{ID_MODEL_ID}=="685c", ACTION=="remove", RUN+="/bin/umount /media/GalaxyNexus"
ENV{ID_MODEL}=="Galaxy_Nexus", ENV{ID_MODEL_ID}=="6860", ACTION=="remove", RUN+="/bin/umount /media/GalaxyNexus"


# Acer A500 16 Gb Bootloader & recovery mode
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", ATTR{idProduct}=="3201", MODE="0666" # Bootloader
#SUBSYSTEM=="usb", ATTR{idVendor}=="0502", ATTR{idProduct}=="d001", MODE="0666" # Recovery

# Acer A500 16 Gb PTP mode (camera)
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", ATTR{idProduct}=="33b2", MODE="0666" # PTP media
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", ATTR{idProduct}=="33b1", MODE="0666" # PTP media with USB debug on

# Acer A500 16 Gb MTP mode (multimedia device)
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", ATTR{idProduct}=="3341", MODE="0666" # MTP media
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", ATTR{idProduct}=="3325", MODE="0666" # MTP media with USB debug on

# Acer A500 MTP mode : automatic mount when plugged
ENV{ID_MODEL}=="Acer_Iconia_Tab_A500", ENV{ID_MODEL_ID}=="3341", ACTION=="add", RUN+="/usr/bin/sudo -u #YOURLOGIN# /usr/local/sbin/go-mtpfs -allow-other=true /media/A500"
ENV{ID_MODEL}=="Acer_Iconia_Tab_A500", ENV{ID_MODEL_ID}=="3325", ACTION=="add", RUN+="/usr/bin/sudo -u #YOURLOGIN# /usr/local/sbin/go-mtpfs -allow-other=true /media/A500"

# Acer A500 MTP mode : automatic unmount when unplugged
ENV{ID_MODEL}=="Acer_Iconia_Tab_A500", ENV{ID_MODEL_ID}=="3341", ACTION=="remove", RUN+="/bin/umount /media/Nexus7"
ENV{ID_MODEL}=="Acer_Iconia_Tab_A500", ENV{ID_MODEL_ID}=="3325", ACTION=="remove", RUN+="/bin/umount /media/A500"

NOTE: if you used gedit and you have edited the file, you need to remove 99-android.rules~ as udev will get upset..

Next, restart udev

# sudo service udev restart

Edit /etc/fstab

Add the following to /etc/fstab
DeviceFs(Nexus\0407)        /media/Nexus7         fuse.DeviceFs(Nexus\0407)      allow_other,rw,user,noauto    0    0
DeviceFs(Galaxy\040Nexu)    /media/GalaxyNexus    fuse.DeviceFs(Galaxy\040Nexu)  allow_other,rw,user,noauto    0    0
DeviceFs(A500)              /media/A500           fuse.DeviceFs(A500)            allow_other,rw,user,noauto    0    0

Finished.

You can now connect your devices and the internal storage will be available for use, you should remember to un-mount before disconnecting though it doesn't seem to do any harm..

Note: it seems that the ENV{ID_MODEL} for the nexus 7 changed to Nexus_7 at some point (I think with the android 4.2 update)..

From http://www.winters.org.nz/android-hints-tips-stuff/working-mtp-on-ubuntu

0

Well, There's a very useful tool, its name is "Wifi File Transfer". Just download it from Play Store on your Android device and install it. It turns your android mobile on a mini server that allows you to download and upload files from and to your phone.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .