jmtpfs: Exchanging files between Android devices and Linux

Update to the Update: jmtpfs-0.4.tar.gz. Improved Mac OS X compatibility.

Update: jmtpfs-0.3.tar.gz. Now works under Mac OS X.

A couple weeks ago I upgraded my phone from a Nexus One to a Samsung Galaxy Nexus.

I connected the Nexus One to my linux (Fedora 16) laptop using the USB cable, and the phone appeared in the file manager. I copied my music and pictures from the phone to the laptop. I then disconnected the Nexus One, connected the Galaxy Nexus, and…. nothing. No phone appeared in the file manager into which I could copy my files. What? Hello?

It turns out Google has depreciated the USB Mass Storage protocol the older phones used in favor of MTP (Media Transfer Protocol), and there isn’t a good MTP file manager implementation for linux. There is libmtp, a library with implements the MTP protocol and seems to work pretty well, but none of the downstream apps I tried (gMTP, Rhythmbox,  MTPfs, …) worked correctly with the Galaxy Nexus.

So presenting jmtps, a FUSE based MTP filesystem designed to make exchanging files between Android devices and Linux work as well as it did with using USB Mass Storage. Its still work in progress, but I believe at this point I have all the basic filesystem operations working correctly, so that things like cp, mv, find, ls, rsync, df, and such will all behave as expected.

The Galaxy Nexus smartphone running Android

The Galaxy Nexus smartphone running Android

Source code for the initial release: jmtpfs-0.1.tar.gz. Hopefullly soon I’ll have some time to put together a Fedora RPM that includes the right udev incantations to make devices automatically mount when they’re connected. For now you have to use the command line to mount the device. But once that’s done it should be safe to use a graphical file manager to transfer files.

From the README…..

jmtpfs:

jmtpfs is a FUSE and libmtp based filesystem for accessing MTP (Media Transfer
Protocol) devices. It was specifically designed for exchaning files between
Linux systems and newer Android devices that support MTP but not USB Mass
Storage.

The goal is to create a well behaved filesystem, allowing tools like find and
rsync to work as expected. MTP file types are set automatically based on file
type detection using libmagic. Setting the file appears to be necessary for
some Android apps, like Gallery, to be able to find and use the files.

Since it is meant as an Android file transfer utility, and I don’t have
any non-Android MTP devices to test with, playlists and other non-file
based data are not supported.

Building and installing:

See the INSTALL file.

Usage:

Run jmtpfs with a directory as a parameter, and it will mount to that directory
the first MTP device it finds. You can then access the files on the device as
if it were a normal disk.

[jason@colossus ~]$ jmtpfs ~/mtp
Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note.
Android device detected, assigning default bug flags
[jason@colossus ~]$ ls ~/mtp
Internal Storage
[jason@colossus ~]$ ls ~/mtp/Internal\ Storage/
Android burstlyImageCache DCIM Music Notifications Pictures testdir
[jason@colossus ~]$ df -h ~/mtp/Internal\ Storage
Filesystem Size Used Avail Use% Mounted on
jmtpfs 14G 3.1G 11G 23% /home/jason/mtp
[jason@colossus ~]$ cd ~/mtp/Internal\ Storage/
[jason@colossus Internal Storage]$ ls
Android burstlyImageCache DCIM Music Notifications Pictures testdir
[jason@colossus Internal Storage]$ cat > test.txt
Hello Android!
[jason@colossus Internal Storage]$ ls
Android DCIM Notifications testdir
burstlyImageCache Music Pictures test.txt
[jason@colossus Internal Storage]$ cat test.txt
Hello Android!
[jason@colossus Internal Storage]$ rm test.txt
[jason@colossus Internal Storage]$

Pass the -l option will list the attached MTP devices.

[jason@colossus ~]$ workspace/jmtpfs/src/jmtpfs -l
Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note.
Available devices (busLocation, devNum, productId, vendorId, product, vendor):
2, 19, 0×6860, 0x04e8, GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note, Samsung

You can choose which device to mount with the -device option.

[jason@colossus ~]$ workspace/jmtpfs/src/jmtpfs -device=2,19 ~/mtp
Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note.
Android device detected, assigning default bug flags
[jason@colossus ~]$ ls ~/mtp
Internal Storage

Unmount with fusermount.

[jason@colossus ~]$ ls ~/mtp
Internal Storage
[jason@colossus ~]$ fusermount -u ~/mtp
[jason@colossus ~]$ ls ~/mtp
[jason@colossus ~]$
Performance and implementation notes:

libmtp (and I assume the MTP protocol itself) doesn’t support seeking within a
file or partial file reads or writes. You have to fetch or send the entire
file. To simluate normal random access files, when a file is opened the entire
file contents are copied from the device to a temporary file. Reads and writes
then operate on the temporary file. When the file is closed (or if a flush or
fsync occurs) then if a write has occurred since the file was last opened the
entire contents of the temporary file are sent back to the device. This means
repeatedly opening a file, making a small change, and closing it again will
be very slow.

Renaming or moving a file is implemented by copying the file from the device,
writing it back to the device under the new name, and then deleting the
original file. This makes renames, especially for large files, slow. This
has special significance when using rsync to copy files to the device. Rsync
copies to a temporary file, and then when the copy is complete it renames the
temporary file to the real filename. So when rsyncing to a jmtpfs filessystem,
for each file, the data gets copied to the device, read back, and then copied
to the device again. There is a true rename (but not move) supported by libmtp,
but this appears to confuse some Android apps, so I don’t use it. Image files,
for example, will disappear from the Gallery if they’re renamed.

125 Comments

  1. Ben Rosenberg says:

    The link for the download is broken. I was trying to get 0.3 to compile but it doesn’t like Ubuntu 12′s 1.1.3 libmtp and I was hoping 0.4 would actually just look for 1.1.x instead of 1.1.0 specifically.

    • Jason Ferrara says:

      I fixed the link. I’m not sure how it got broken.

      jmtpfs 0.4 should build with libmtp 1.1.3. Most of my testing was done with libmtp 1.1.3 under Fedora and libmtp 1.1.2 under Mac OS X.

      • Cristian Florescu says:

        Thank you,
        You’ve save me … for almost few days I’ve tested different mtp (FS) packages. My box is FC16 and on the other side Android on Acer Iconia Tab A500 (ICS). jmtpfs working like a charm.

      • otx says:

        The jmtpfs-0.4.tar.gz file is missing from your site. I have checked every folder in uploads and there is only the jmtpfs-0.1.tar.gz. Can you fix it, please?

        • admin says:

          Fixed

          • otx says:

            Thanks! And while everything else fails, this just works. Good work!

  2. Christophe-Marie says:

    Hi,

    I thought the android kernel did not support fuse. Is this something new?

    Cheers

    • Anon says:

      Obviously this is not running on Android but on a non-Android computer connecting to MTP.

  3. Han-Wen Nienhuys says:

    You might be interested in github.com/hanwen/go-mtpfs too.

  4. KMan says:

    Thank you for this. Finally a working method to move files from linux to my Galaxy Nexus. mtpfs was way too buggy to be of any practical use.

  5. Carlos says:

    After compiling jmtpfs on Debian Testing amd64, i just got unlucky with a Galaxy S3:

    mystery@debian:~$ jmtpfs /home/mystery/mtp
    Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note.
    PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
    LIBMTP libusb: Attempt to reset device
    LIBMTP PANIC: failed to open session on second attempt
    terminate called after throwing an instance of ‘MtpErrorCantOpenDevice’
    what(): Can’t open device
    Aborted

    • Jean-Nicolas says:

      For Galaxy Samsung S3, see my post there:

      http://forums.fedoraforum.org/showthread.php?t=284741

    • Nick Whitelegg says:

      To confirm what Jean-Nicolas said, upgrading to libmtp-1.1.5 from 1.1.3 (requires compile from source) on Ubuntu 12.04 makes a big difference – from waiting about 30 seconds and sometimes core-dumping to instantaneously mounting.

  6. Simon Dedman says:

    Hi. Love the idea of this but am pretty n00b when it comes to compiling. Seems that I have the packages but latest ubuntu uses libmtp9 so ./configure can’t find libmtp:

    “No package ‘libmtp’ found

    Consider adjusting the PKG_CONFIG_PATH environment variable if you
    installed software in a non-standard prefix.

    Alternatively, you may set the environment variables MTP_CFLAGS
    and MTP_LIBS to avoid the need to call pkg-config.
    See the pkg-config man page for more details.”

    I looked at the man page but got stumped pretty quickly. Any quick tips for users on ubuntu 12.04?

    Thanks in advance
    Si

  7. Simon Dedman says:

    [i thought i already posted this but it seems it didn't take; apologies if it went through fine and is awaiting moderation]

    Ubuntu 12.04: i have libmtp9 not libmtp, so the compiler fails. I tried to work out how to correct for this using the man pages but this isn’t my strongest suit! Any tips?

    Thanks

  8. Vicente says:

    dear Jason
    got the following error while compiling your app. anything I can do?

    In file included from ConnectedMtpDevices.h:24:0,
    from jmtpfs.cpp:22:
    MtpDevice.h:30:19: fatal error: magic.h: No such file or directory
    compilation terminated.
    make[1]: *** [jmtpfs-jmtpfs.o] Error 1
    make[1]: Leaving directory `/home/vicente/jmtpfs-0.4/src’
    make: *** [all-recursive] Error 1

  9. Vicente says:

    SOLVED my issue. I was missing libmagic library and header…
    sorry to bother you with my previous message.

  10. Vicente says:

    Dear Jason:
    here’s an error I can’t figure out:

    [root@idea vicente]# jmtpfs ~/mtp
    Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note.
    PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
    LIBMTP libusb: Attempt to reset device
    LIBMTP PANIC: failed to open session on second attempt
    terminate called after throwing an instance of ‘MtpErrorCantOpenDevice’
    what(): Can’t open device
    Aborted (core dumped)

    • nojokes says:

      I am having the same issue:

      neutronst4r@Nibbler:~$ jmtpfs /media/Nero
      Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note.
      PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
      LIBMTP libusb: Attempt to reset device

  11. Michael Samuel says:

    I made a basic debian/ dir for Debian/Ubuntu packaging, which you could include in the source to make things easier for users of those systems.

    If you’re interested, drop me a note and I’ll send it over

  12. aaa says:

    You are a hero… Didn’t work flawless, but this seems to be some ubuntu rights management (after taking sudo it worked and thats what is important).

    THX

  13. Rainer Peter Feller says:

    You are our HERO, since mtpfs is not working this is the only possibility to actualy mount the Nexus via usb.
    Yes it is slow, but I don’t think it is slower than with windows.
    Windows is cheating at this point :-) You have a filebrowser connected to the device and not a transparent systemwide access to the device.
    This is somehow more complete.

    THANKS!

  14. H4wkmoon says:

    Hi,

    wonderfull tool! Thanks.
    Works nicely for my wife’s xoom.
    Not for my new S3, under ubuntu (precise)
    Device is detected as a S2/Note/Nexus (it seems ok to me)

    Error is :

    PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
    LIBMTP libusb: Attempt to reset device
    LIBMTP PANIC: failed to open session on second attempt
    terminate called after throwing an instance of ‘MtpErrorCantOpenDevice’
    what(): Can’t open device
    Abandon (core dumped)

    Could you confirm that this is related to libmtp, and not your code plz ?

    • J Ferrara says:

      Can you see if it works with the libmtp command line tools. Try running mtp-filetree. If that fails also then the problem is with libmtp. If it works then the problem is probably on my end somewhere.

      • Al says:

        It looks like libmtp. The command mtp-filetree also fails with the error. Again, thanks for your code!

  15. C says:

    Hi,

    first of all thanks a lot for this useful program!
    The rsync-problem can be solved, if one uses the “–inplace” option of rsync. Might have bad side effects, so it should be handled with care ;)

    thanks again c

  16. Mike says:

    Sorry, but:
    (Ubuntu 12.04)

    root@Home-PC:/home/tmp/jmtpfs-0.4# make
    Making all in src
    make[1]: Entering directory `/home/tmp/jmtpfs-0.4/src’
    g++ -g -O2 -std=c++0x -lmagic -o jmtpfs jmtpfs-jmtpfs.o jmtpfs-MtpDevice.o jmtpfs-ConnectedMtpDevices.o jmtpfs-Mutex.o jmtpfs-MtpFilesystemPath.o jmtpfs-MtpMetadataCache.o jmtpfs-MtpNode.o jmtpfs-MtpRoot.o jmtpfs-MtpLibLock.o jmtpfs-MtpStorage.o jmtpfs-MtpFolder.o jmtpfs-MtpFile.o jmtpfs-TemporaryFile.o jmtpfs-MtpLocalFileCopy.o jmtpfs-MtpFuseContext.o -lmtp -lusb-1.0 -pthread -lfuse -lrt -ldl
    jmtpfs-MtpDevice.o: In function `MtpDevice’:
    /home/tmp/jmtpfs-0.4/src/MtpDevice.cpp:71: undefined reference to `magic_open’
    /home/tmp/jmtpfs-0.4/src/MtpDevice.cpp:74: undefined reference to `magic_load’
    /home/tmp/jmtpfs-0.4/src/MtpDevice.cpp:75: undefined reference to `magic_error’
    jmtpfs-MtpDevice.o: In function `MtpDevice::SendFile(LIBMTP_file_struct*, int)’:
    /home/tmp/jmtpfs-0.4/src/MtpDevice.cpp:244: undefined reference to `magic_buffer’
    collect2: ld returned 1 exit status
    make[1]: *** [jmtpfs] Error 1
    make[1]: Leaving directory `/home/tmp/jmtpfs-0.4/src’
    make: *** [all-recursive] Error 1
    root@Home-PC:/home/tmp/jmtpfs-0.4#

    • J Ferrara says:

      Make sure you have libmagic-dev installed.

      • Daniel says:

        …and run ./configure once again.

  17. Lonni J Friedman says:

    Hi, I’m trying to build 0.4 on a Fedora16 system, and the ./configure step is failing:
    ###########
    checking for pkg-config… /usr/bin/pkg-config
    checking pkg-config is at least version 0.9.0… yes
    checking for MTP… no
    configure: error: Package requirements (libmtp >= 1.1.0) were not met:

    No package ‘libmtp’ found

    Consider adjusting the PKG_CONFIG_PATH environment variable if you
    installed software in a non-standard prefix
    ###########

    Contrary to what the output is claiming, I do in fact have libmtp installed:
    $ rpm -q libmtp
    libmtp-1.1.3-2.fc16.i686

    I’m not sure what to do next to make this build. Help?!

  18. Lonni J Friedman says:

    Nevermind, I figured it out. What i really needed was libmtp-devel and libfuse-devel, and then it built just fine.

    • John Kim says:

      Thanks very much Lonni! Appreciate the solution you found out.

      For anyone stumped with the “no package libmtp” dilemma, this is the answer to come to.

  19. Sebastien ROHAUT says:

    Thank you very much !

    mtpfs couldn’t display files from my Archos 70b IT, and with jmtpfs it works very well.

    It’s a very good work.

  20. J Ferrara says:

    Sorry about the delay in approving comments.

    We had a glitch in the web site where it wasn’t notifying me that there we comments waiting for approval.

  21. rubik says:

    Hi! I have libmtp v1.1.3 installed (ArchLinux). When I try to mount my Galaxy Nexus – ICS v4.3 it succeds but then I get a weird error while trying to access the directory:

    $ jmtpfs Galaxy/
    Device 0 (VID=04e8 and PID=685c) is a Samsung Galaxy Nexus/Galaxy S i9000/i9250, Android 4.0 updates.
    Android device detected, assigning default bug flags
    $ ls Galaxy
    ls: cannot access Galaxy: Input/output error
    $ e2fsck Galaxy
    e2fsck 1.42.4 (12-June-2012)
    e2fsck: Is a directory while trying to open Galaxy

    The superblock could not be read or does not describe a correct ext2
    filesystem. If the device is valid and it really contains an ext2
    filesystem (and not swap or ufs or something else), then the superblock
    is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193

    If it’s needed I can post mtp-detect output…

    Thank you!
    rubik

    • Dan says:

      I have the same Input/Output error when mounting my Nexus (with ICS) on Ubuntu 12.04 with libmtp 1.1.3.

  22. lev says:

    How about Fedora 17?
    make say:
    jmtpfs.cpp: In function ‘int main(int, char**)’:
    jmtpfs.cpp:454:90: error: ‘getuid’ was not declared in this scope
    jmtpfs.cpp:454:100: error: ‘getgid’ was not declared in this scope
    make[1]: *** [jmtpfs-jmtpfs.o] Error 1
    make[1]: Leaving directory `/jmtpfs-0.4/src’
    make: *** [all-recursive] Error 1

    Ideas?

    Thanks for answer.

    • Jason Ferrara says:

      Add…

      #include <unistd.h>

      near the top of src/jmtpfs.cpp.

      • Al says:

        Thank you so much for your code! However, using a Samsung Galaxy 3S, the following occurs after successful compile. Tried with two different USB cables on different USB ports:

        # jmtpfs /media/phone
        Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note.
        PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
        LIBMTP libusb: Attempt to reset device
        LIBMTP PANIC: failed to open session on second attempt
        terminate called after throwing an instance of ‘MtpErrorCantOpenDevice’
        what(): Can’t open device
        Aborted (core dumped)
        [root@bugsy media]# jmtpfs /media/phone
        Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note.
        PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
        LIBMTP libusb: Attempt to reset device
        LIBMTP PANIC: failed to open session on second attempt
        terminate called after throwing an instance of ‘MtpErrorCantOpenDevice’
        what(): Can’t open device
        Aborted (core dumped)

        • J Ferrara says:

          What happens if connect the device and run mtp-filetree (provided by the libmtp-examples rpm)?

          • Dez Futak says:

            Here’s what I get:

            mtp-filetree
            Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note.
            Attempting to connect device(s)
            PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
            LIBMTP libusb: Attempt to reset device
            LIBMTP PANIC: failed to open session on second attempt
            Unable to open raw device 0
            OK.

            Best regards,

            Dez.

    • Al says:

      Add this near the top of your source:

      #include
      #include

      It compiles without error in F17 then. Well, it did for me :)

    • Al says:

      okay, the web page is stripping off the stuff between less-than and greater-than signs. One more try…

      #include (less-than-sign)unistd.h(greater-than-sign)
      #include (less-than-sign)sys/types.h(greater-than-sign)

    • nfo says:

      i run into the same problem, just
      add following line to src/jmtpfs.cpp
      #include

  23. dummy says:

    Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note.
    PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
    LIBMTP libusb: Attempt to reset device
    LIBMTP PANIC: failed to open session on second attempt
    terminate called after throwing an instance of ‘MtpErrorCantOpenDevice’
    what(): Can’t open device
    Aborted (core dumped)

  24. dummy says:

    sorry mydeviceis GS3,it was not in this category
    “” Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note”"
    is your solution work?
    thanks

  25. Neville says:

    For OSX users there is http://www.android.com/filetransfer/, which seem to work well. I am surprised this isn’t open source and available on Linux

  26. Lonni J Friedman says:

    This seems to work ok with my Nexus7 and Fedora16, however I’m seeing something odd with the reported size of the mounted file system. When on the Nexus7 the /sdcard partition is reported as 5GB with 475MB used:
    Filesystem Size Used Free Blksize
    /storage/sdcard0 5G 475M 5G 4096

    Yet, when I mount using jmtpfs, I see completely different numbers (smaller/lower):
    Filesystem Size Used Avail Use% Mounted on
    jmtpfs 2.0G 476M 1.5G 25% /tmp/n7

    Is this a bug? Is jmtpfs not mounting the same thing?

    • Lonni J Friedman says:

      Even more strange, if I copy a file over jmtpfs that is larger than the space it claims is available, the copy works, but then I start to see bizarre information reported back for the Used/Avail in df output:

      Filesystem Size Used Avail Use% Mounted on
      jmtpfs 2.0G -1.6G 3.5G – /tmp/n7

      BTW, Is there some way to track or be notified of new jmtpfs releases other than looking at this page’s URL periodically?

  27. Uwe says:

    Works like a charm after compiling libmtp and your package v0.4 on Linux Mint 10…thanks!

  28. Uwe says:

    Trying to compile on Ubuntu 10.04.4, I get the following error:

    Making all in src
    make[1]: Entering directory `/home/hoover/tmp/jmtpfs-0.4/src’
    g++ -DPACKAGE_NAME=\”jmtpfs\” -DPACKAGE_TARNAME=\”jmtpfs\” -DPACKAGE_VERSION=\”1.0\” -DPACKAGE_STRING=\”jmtpfs\ 1.0\” -DPACKAGE_BUGREPORT=\”\” -DPACKAGE_URL=\”\” -DPACKAGE=\”jmtpfs\” -DVERSION=\”1.0\” -DHAVE_LIBMAGIC=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_MAGIC_H=1 -I. -I/usr/local/include -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse -g -O2 -std=c++0x -MT jmtpfs-jmtpfs.o -MD -MP -MF .deps/jmtpfs-jmtpfs.Tpo -c -o jmtpfs-jmtpfs.o `test -f ‘jmtpfs.cpp’ || echo ‘./’`jmtpfs.cpp
    jmtpfs.cpp:288: warning: invalid access to non-static data member ‘jmtpfs_options::listDevices’ of NULL object
    jmtpfs.cpp:288: warning: (perhaps the ‘offsetof’ macro was used incorrectly)
    jmtpfs.cpp:289: warning: invalid access to non-static data member ‘jmtpfs_options::listDevices’ of NULL object
    jmtpfs.cpp:289: warning: (perhaps the ‘offsetof’ macro was used incorrectly)
    jmtpfs.cpp:292: warning: invalid access to non-static data member ‘jmtpfs_options::displayHelp’ of NULL object
    jmtpfs.cpp:292: warning: (perhaps the ‘offsetof’ macro was used incorrectly)
    jmtpfs.cpp:293: warning: invalid access to non-static data member ‘jmtpfs_options::device’ of NULL object
    jmtpfs.cpp:293: warning: (perhaps the ‘offsetof’ macro was used incorrectly)
    jmtpfs.cpp:294: warning: invalid access to non-static data member ‘jmtpfs_options::showVersion’ of NULL object
    jmtpfs.cpp:294: warning: (perhaps the ‘offsetof’ macro was used incorrectly)
    jmtpfs.cpp:295: warning: invalid access to non-static data member ‘jmtpfs_options::showVersion’ of NULL object
    jmtpfs.cpp:295: warning: (perhaps the ‘offsetof’ macro was used incorrectly)
    jmtpfs.cpp:296: error: expected primary-expression before ‘.’ token
    make[1]: *** [jmtpfs-jmtpfs.o] Error 1

    configure run looks ok, so I don’t think I’m missing any of the obvious libraries mentioned in other posts. Thanks again for your hard work!

    Uwe

  29. Uwe says:

    Hi folks, here’s an update to the compilation issue: I managed to compile version 0.4 on Ubuntu 10.04.4 by removing the FUSE_OPT_END macro in line 296 of jmtpfs.cpp.

    Also, the warnings mentioned above can be getten rid of by adding

    -Wno-invalid-offsetof

    to the compilation options.

    Cheers, Uwe

  30. Mark Pariente says:

    Dude, thank you so much. The base libmtp implementation has so much trouble connecting to Galaxy Nexus properly. Your implementation connects immediately and can perform fs operations like a charm. Kudos for the great work!

  31. Peter Schmitz says:

    Hi,

    after copying 6GB off an MTP device I get I/O errors, which may be a result of a non-supported device, Acer Iconiatab A700:

    [pete@nb6770] ~ # jmtpfs ~/android
    Device 0 (VID=0502 and PID=3376) is UNKNOWN.
    Please report this VID/PID and the device model to the libmtp development team
    Android device detected, assigning default bug flags

    Cheers

    Peter

    • J Ferrara says:

      Check that you’re not running out of space in /tmp. Because of limitation of mtp all file I/O has to go to a temporary file first and then to its final destination.

  32. Malcolm says:

    Hi
    When building for openSUSE and SLE 11 SP2 on the Open Build Service, I get some [-Wreorder] warnings as well as failing to build with SLE 4.6 gcc-c++ or openSUSE 12.2 and factory with gcc-c++ 4.7.

    The patch I’ve used is here http://paste.opensuse.org/a1dcbb87 to clear all this issues.

  33. Jerome says:

    A thing of beauty.

    Running perfectly connecting a Google Nexus 7 to an Archlinux machine.
    Had to add
    #include
    near the top of src/jmtpfs.cpp as per Jason’s comnent on 25/08/2012 (see above).

    Many thanks.

  34. nadley says:

    Hi,
    Thanks for your work, I finaly find a tool to access my Galaxy Tab 2.

    Small suggest that would be nice if you can put this on github or other version control system, that will be easy for use to catch updates !!

    Thanks again

    • Lonni J Friedman says:

      Sadly, I think jmtpfs has become abandonware. The author hasn’t replied to any comments in many months.

      • J Ferrara says:

        Nope. I’m still here. I’ve just been really busy recently. I got this crazy idea that I should do a full engine rebuild and upgrade on my car myself, and that has sucked up all my spare time. Hopefully that will be finished in a couple week.

        The source is currently in our own subversion repository. I’ll see if can make that publicly available.

        I started with the source in git with the intent of putting it up on github, but I’m using Eclipse, and Egit kept corrupting the repository. The subversion plugin for Eclips seems much better behaved.

  35. phonky says:

    This looks like the tool I want! Great work, you’re making lots of people happy :)

    I want to join the party too though: I am having the same issues as some other folks here with a Galaxy S3, it’s not being recognized:

    jmtpfs galaxyS3/
    Device 0 (VID=04e8 and PID=6860) is a Samsung GT-P7310/P7510/N7000/I9100/Galaxy Tab 7.7/10.1/S2/Nexus/Note.
    PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
    LIBMTP libusb: Attempt to reset device
    LIBMTP PANIC: failed to open session on second attempt
    terminate called after throwing an instance of 'MtpErrorCantOpenDevice'
    what(): Can't open device
    Aborted (core dumped)

    • J Ferrara says:

      As far as I can tell without having an S3 myself, its a libmtp issue. Try running mtp-filetree. If that fails, ask the libmtp people.
      http://libmtp.sourceforge.net/
      If it works then the issue is on my end somewhere. Let me know and I’ll see what I can do, but I probably can’t do much unless I can get hold of an S3.

  36. Alexey Solomatin says:

    Thanks a lot! It works on my Samsung Galaxy S III.

  37. aka says:

    thank’s i have it working in ubuntu 12.04

  38. Boler says:

    If you install the latest version of libmtp then it ‘just works’ using:

    mtpfs -o allow_other /mnt/galaxy/

    Unmount with

    fusermount -u /mnt/galaxy/

    I compiled libmtp from source from here:

    git clone git://libmtp.git.sourceforge.net/gitroot/libmtp/libmtp

    I’m using Xubuntu 12.04 and an AT&T Galaxy S3.

  39. 320x200 says:

    Thanks! Worked like a charm on Debian Sid + Nexus 7.

  40. silver account says:

    on the SD card/external storage. You then would connect your Android device via USB with your computer, enable USB mass storage, and simply copy the file off the device.

  41. Sergey says:

    df and du work strage on jmtpfs:

    df -h

    jmtpfs 990M -2.8G 3.8G – /home/ssmirnov/SGS3

    du -sh /home/ssmirnov/SGS3/Card
    0 /home/ssmirnov/SGS3/Card

  42. Fabio Correa says:

    Hello, I implemented the automount services for jmtpfs; I hope these are helpful.

    File /etc/udev/rules.d/99-jmtpfs.rules

    # Automount an MTP device with jmtpfs
    ACTION=="add", ENV{ID_MTP_DEVICE}=="1", RUN="/usr/local/sbin/mountmtp mtp%k"
    ACTION=="remove", ENV{ID_MTP_DEVICE}=="1", RUN="/usr/local/sbin/umountmtp mtp%k"

    Script /usr/local/sbin/mountmtp

    #!/bin/bash
    mkdir -p /media/$1
    jmtpfs -o allow_other /media/$1 |& logger -t jmtpfs

    Script /usr/local/sbin/umountmtp

    #!/bin/bash
    umount -v /media/$1 |& logger -t jmtpfs
    rmdir /media/$1

    • Paul Hunnisett says:

      What does mtp%k resolve to? In other words, where does this mount the device? Will this work on all systems as is, or would I need to make some customisations?

    • Lox says:

      Anyway so that the unmount icon in nautilus can actually unmount it ? I get an error:

      umount : /media/mtp1-1.4.2 is not in fstab (and you are not root)

  43. Geza Giedke says:

    thanks a lot for your work; I got jmtpfs 0.4 to work on openSUSE 12.2. – just needed the packages libmtp, fuse, file, and the corresponding -devel packages. Then everything goes smoothly – whereas I did not succeed to access the Nexus 7 using just mtp (or gMTP): I saw the directory structure but no contents and could not copy. With jmtpfs everything works fine. Thanks again!

    regards
    Geza

  44. Adam says:

    Hi, first i mus say, this is great, this is the first thing that has even come close to solving this for me, however, while i can connect, access the Internal storage an move files to it, i cant move files to the SD card folder, i just get input/output errors everytime i try, ive tried mounting as root and still cant write to it, the df output is everything as 0.0 bytes, anyone else figured this out?

    • Bill Witry says:

      You may want to consider a different paradigm:
      1. Install ES File Explorer
      2. Select Settings
      3. Select Remote Settings (mote the FTP Address)
      4. Open a browser session
      5. Enter the FTP address

  45. Mark Pariente says:

    Jason, are you considering upstreaming your changes to libmtp?

    BTW, for anyone interested, I’m maintaining Gentoo ebuilds for jmtpfs:
    https://github.com/mrpdaemon/gentoo-overlay/tree/master/sys-fs/jmtpfs

    Regards,
    Mark

  46. Kurt says:

    Thanks so much! Got a Galaxy Nexus today and wondered how I could get mass storage to work. Just had to get some of the dependencies via apt-get to make it cleanly through the ./configure script, and make worked without a hitch on Lint 13 (based on Ubuntu 12.04). Mount worked first try.

    Great job – thanks again

  47. Emmett says:

    I can’t even get past the ./configure part, this is what I get.

    checking build system type… x86_64-unknown-linux-gnu
    checking host system type… x86_64-unknown-linux-gnu
    checking target system type… x86_64-unknown-linux-gnu
    checking for a BSD-compatible install… /usr/bin/install -c
    checking whether build environment is sane… yes
    checking for a thread-safe mkdir -p… /bin/mkdir -p
    checking for gawk… no
    checking for mawk… mawk
    checking whether make sets $(MAKE)… yes
    ./configure: line 2750: AX_CXX_COMPILE_STDCXX_0X: command not found
    checking for g++… no
    checking for c++… no
    checking for gpp… no
    checking for aCC… no
    checking for CC… no
    checking for cxx… no
    checking for cc++… no
    checking for cl.exe… no
    checking for FCC… no
    checking for KCC… no
    checking for RCC… no
    checking for xlC_r… no
    checking for xlC… no
    checking whether the C++ compiler works… no
    configure: error: in `/home/emmett/Desktop/jmtpfs’:
    configure: error: C++ compiler cannot create executables
    See `config.log’ for more details

    Since this is kind of old now, is there a updated verion?
    P.S. Using Ubuntu 12.10

    • Emmett says:

      Nevermind, I got it installed. Had to install g++ and add an additional line at the top of jmtpfs.cpp.
      #include
      Thanks to the people of xda. ;-)

  48. phoboid says:

    version 0.4 failed to compile on my system (Ubuntu 12.10). It worked after adding

    #include

    to the file jmtpfs.cpp (it was missing getuid and getgid)

  49. Forrest Cahoon says:

    Just tried to compile 0.4 on Debian sid, and got this error:

    jmtpfs.cpp: In function ‘int main(int, char**)’:
    jmtpfs.cpp:454:90: error: ‘getuid’ was not declared in this scope
    jmtpfs.cpp:454:100: error: ‘getgid’ was not declared in this scope

    I fixed this by adding these lines to jmtpfs.cpp:

    #include
    #include

    • Forrest Cahoon says:

      Still no success though: I’ve tried with jmtpfs 0.3 and 0.4 and libmtp 1.1.3 (Debian-packaged) and 1.1.5 (built from source) and am still getting errors like this:

      forrest@supercool:~$ jmtpfs -o allow_other ~/s3
      Error: Unable to open ~/.mtpz-data for reading.
      Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).
      PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
      LIBMTP libusb: Attempt to reset device
      LIBMTP PANIC: failed to open session on second attempt
      terminate called after throwing an instance of ‘MtpErrorCantOpenDevice’
      what(): Can’t open device
      Aborted

  50. Biji says:

    Nice!! thanks for making it

  51. Dave Sill says:

    Built an installed under Fedora 17. Attached Nexus 4 set to MTP. Did the mount, but ls on mount point gives “ls: cannot access mtp: Input/output error”

    • Dave Sill says:

      OK, tried the ls again and it’s working.

  52. wolfi says:

    Hi,
    got it work with fedora-16 (i386) and a Samsung Galaxy NoteII.
    but I have compile problems on fedora-17 (i386).
    There – the build (vers 0.4) fails with:

    jmtpfs.cpp: In function ‘int main(int, char**)’:
    jmtpfs.cpp:454:90: error: ‘getuid’ was not declared in this scope
    jmtpfs.cpp:454:100: error: ‘getgid’ was not declared in this scope
    make[1]: *** [jmtpfs-jmtpfs.o] Error 1

    as a fix – just add in src/jmtpfs.cpp these lines:

    #include
    #include

    …and bingo – compiles fine.

    Otherwise – REALLY CUTE tool.

    w

  53. Michael Tokarev says:

    Hello. After lots of googling and asking around, I come across this site and compiled jmtpfs-0.4 (jmptfs.cpp needs to #include for several std unix syscalls). Good job, much better than mtpfs indeed.

    One fun thing I noticed however — du from coreutils 8.13 shows all jmptfs-mounted directories and files as having zero bytes in size, even if actual files inside are non-zeros. It looks like this is due to the way stat() syscall is implemented: it always returns st_blocks==0, and that’s what du reports… I wonder if du should be improved there, to check if st_blocks==0 and use st_size in that case :)

  54. Davidoff says:

    Hi,

    Excellent package! Got it working with my Motorola Xoom (Android 4.0.4) with OpenSUSE 12.2 where plain mtpfs just didn’t connect at all (though it sort-of worked, sometimes, on the original Xoom Android 3). jmtpfs thus far seems stable & reliable.

    All of the dependencies where already present (from above attempts with mtpfs) though magic.h wasn’t in the standard include paths – I just copied it to /usr/include.

    I did have a problem compiling src/jmtpfs.cpp; gcc (v4.7.1) complained about getuid() & getgid() [Line 454] being ‘not in scope’. I edited this file and added a line #include (where these functions are defined) and all then built & installed with no further problems.

    I’ve implemented connecting specifically for my Xoom (with thanks to Fabio’s contribution, combined with a piece in Linux Format magazine #165) with:

    /etc/udev/rules.d/90-motorola-xoom.rules

    # Automount a Motorola Xoom device with MTP access using jmtpfs
    ATTR{idVendor}=="22b8", ATTR{idProduct}=="70a8", RUN="/usr/local/sbin/xoom"

    (other devices will have different ATTR values) and

    /usr/local/sbin/xoom

    #!/bin/bash
    xdir=/media/xoom
    if [[ $1 == "unmount" ]] || \
    [[ $1 == "-u" ]] || \
    [[ -d $xdir ]]; then
    fusermount -u $xdir |& logger -t jmtpfs
    rmdir $xdir
    else
    mkdir -p $xdir
    jmtpfs -o allow_other $xdir |& logger -t jmtpfs
    fi

    - so that the script will by default mount the Xoom if not already mounted and dismount it if it is (simple test on the mount point existing – this could be improved) or explicitly run with ‘xoom -u’ or ‘xoom unmount’.

    I find it ironic that connecting an Android device (essentially Linux) to Windows ‘just works’, but one has to go to some lengths to make it play with Linux! MTP surely must one day be supported by Linux ‘out of the box’ as USB is.

    Anyway, thx & well done Jason!!
    Dave

  55. Philip Aston says:

    Thanks for this.
    Referring to your July 25 post, I confirm that the unistd.h insertion worked for fc17 (not needed on fc16) to build the software, and mounted Kindle Fire HD.

  56. Dedy Martadinata says:

    ok, thanks work well on my galaxy tab 7.0 P3100

  57. Daniel Tarrant says:

    All a bit strange… I had no luck with my Xperia Ray until I added:


    # Xperia Ray
    ATTRS{idVendor}=="0fce" , ATTRS{idProduct}=="5161" , ENV{ID_MEDIA_PLAYER}="sony-ericsson_xperia-ray"

    to 40-usb-media-players.rules file in lib/udev/rules.d

    This seems to work… sometimes!!! It doesn’t make a connection perhaps 3 out of 5 attempts.


    danielgt@ubuntu:~$ jmtpfs mtp
    Device 0 (VID=0fce and PID=5161) is a SonyEricsson ST18i Xperia Ray.
    PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
    LIBMTP libusb: Attempt to reset device
    LIBMTP PANIC: failed to open session on second attempt
    terminate called after throwing an instance of 'MtpErrorCantOpenDevice'
    what(): Can't open device
    Aborted (core dumped)
    danielgt@ubuntu:~$ jmtpfs mtp
    Device 0 (VID=0fce and PID=5161) is a SonyEricsson ST18i Xperia Ray.
    PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
    LIBMTP libusb: Attempt to reset device
    Android device detected, assigning default bug flags
    danielgt@ubuntu:~$ ls mtp
    SD card
    danielgt@ubuntu:~$ fusermount -u mtp
    danielgt@ubuntu:~$

    1) Why would the connection be intermittent like this?
    2) If the Galaxy SIII users tried a similar approach with their own VID and PIDs would they also have some success?

  58. Steve Kumar says:

    Nice work! Thanks a lot.

  59. leden says:

    Hi, I’m hitting a problem compiling at the make stage:
    MtpLocalFileCopy.cpp: In member function ‘void MtpLocalFileCopy::truncate(off_t)’:
    MtpLocalFileCopy.cpp:115:43: error: ‘ftruncate’ was not declared in this scope
    make[1]: *** [jmtpfs-MtpLocalFileCopy.o] Error 1
    make[1]: Leaving directory `/home/lee/Downloads/jmtpfs/src’
    make: *** [all-recursive] Error 1

    I’m trying to do this on kubuntu 12.10 64 bit. Got through the ./configure stage OK.

    Any ideas on how to fix?

    • leden says:

      I fixed this problem by editing the file MtpLocalFileCopy.cpp and adding
      #include <unistd.h>

  60. Adrian says:

    In fedora you need the file-devel file-libs fuse-devel libmtp-devel

  61. Les Labbauf says:

    Trying to compile from source on Fedora 17, configures clean but make fails and I get the following:

    MtpLocalFileCopy.cpp:115:43: error: ‘ftruncate’ was not declared in this scope
    make[1]: *** [jmtpfs-MtpLocalFileCopy.o] Error 1
    make[1]: Leaving directory `jmtpfs/src’

  62. Daniel says:

    The source tarball is not available anymore :(
    Please reupload.

    • admin says:

      Fixed — sorry for the inconvenience.

  63. Alexandre Maisonobe says:

    Hi , the files seems to be broken again, only the 0.1 version is still up
    (http://research.jacquette.com/wp-content/uploads/2012/05/)

    Is there another way to get the 0.4 version ?

    Thanks !!

    • admin says:

      Sorry for the technical difficulty — files have been fixed.

  64. lmichelbacher says:

    I’m trying to recover files from the internal storage on a Nexus 7. Standard recovery tools don’t work because the Nexus only uses MTP an doesn’t show up as a USB device.

    With jmtpfs, can I access the internal storage like a normal mount?

    Thanks.

    • J Ferrara says:

      You can access the internal storage as a normal mount, but not as a raw block device, which is what I think you’re really asking.

      jmtpfs uses MTP, its just that it tries hard to make the MTP device look like a normal filesystem. But it doesn’t provide raw access to the storage device, so you can’t use fsck or other filesystem recovery tools.

  65. Steven Luo says:

    Where do we submit patches? I’ve been carrying a patch locally to respect the environment variable TMPDIR for creating temporary files (I have limited space in /tmp on my system).

    • J Ferrara says:

      jmtpfs is on github now.

      https://github.com/JasonFerrara/jmtpfs

      Send a pull request. Or if you don’t want to go through the work of setting up a git repo just post or email me a diff.

  66. Daniele Segato says:

    Hi,

    I had to modify the src/jmtpfs.cpp file to compile on Debian (same on Ubuntu).

    Adding this include: #include

    It was giving this error on Make:

    jmtpfs.cpp: In function ‘int main(int, char**)’:
    jmtpfs.cpp:454:90: error: ‘getuid’ was not declared in this scope
    jmtpfs.cpp:454:100: error: ‘getgid’ was not declared in this scope

    See: http://forum.xda-developers.com/showthread.php?p=26167785

    Apart from that it worked like a charm, thank you!

  67. Zoidberg says:

    This program is so great! Thank you! I love you!

    I’m using version 0.4 in Arch Linux with a Samsung Galaxy Grand (Android 4.1). I was so tired of testing so many guides and programs, Amarok, Clementine, gMTP, etc. with no success. Finally found the solution in the Arch Wiki (Android article).

  68. l2g says:

    I created an RPM and SRPM of ‘jmtpfs’ so that Centos 6 users can benifit from it. It meant I had to rebuild Rhythmbox and VLC to work against a newer libmtp (1.1.6). Unfortunately I went through all the trouble of doing this in hopes that my new Nikon D7100 would mount properly (but it doesn’t) using your fantastic work. You were the last piece of the puzzle after all the dependency issues were looked after for me… or so I had thought.

    C++11 is great for those running bleeding edge, but the alternative sollution(s) (simple-mtpfs) won’t compile on Centos 6 because of this; yours does though. However… when all is said and done, and my camera is attached to the system… i just get ‘No mtp devices found.’.

    Would there be any value in exchanging some of the system info and rpms I’ve generated in exchange for your help in getting my camera to work? :)

    It sucks when you come so far, and the brick wall shows up now…

    • J Ferrara says:

      Do the command line example tools that come with libmtp work with the D7100?

      If not, then it’s a libmtp issue, and you should ask the libmtp people.

      If they do, then it could be a jmtpfs problem, and I can take a look. I don’t have a D7100, but I have some older Nikon DSLRs.

      • l2g says:

        As it turns out my camera use PTP and not MTP. This is a complete oversight on my part; I posted to you too prematurely unaware of my requirements at the time. That all said, your software is still amazing and brought life to my Nexus 4 from my PC.

        I additionally wrote a small patch for your software it could work in older Linux flavors like mine (CentOS 6) which use an older fuse release (v2.8.3). The patch I created only has 1 tiny code change and then the rest is just to include the udev rules and automount features some of your fantastic followers shared with you on this comment wall.

        The small patch can be seen here:
        https://www.dropbox.com/sh/9dt7klam6ex1kpp/ROL2J09Dfs/20131015/mtp/jmtpfs.centos6.patch

        I hope you’re okay that I’ve documented all my progress as well as re-hosting these RPM packages here:
        http://nuxref.wordpress.com/2013/10/15/upgrading-the-mtp-support-on-centos-6/

        You truly did great work on jmtpfs! Thank you for sharing it with the world! :D

  69. GWO says:

    Hi Jason,

    Great software. Here’s a trivial patch for jmtpfs that solves two problems:
    i) Doesn’t compile with gcc-4.8 as getuid() requires inclusion of
    ii) “jmtpfs -l” SegFaults on NULL-pointer deference with unknown devices.

    Both fixed by the following slight changes (apologies if my indenting doesn’t match your preferences)

    Anyway, its the only software that makes MTP work on my HTC One X, so thanks a lot.

    Gareth

    – Cut Here –

    diff –git a/src/ConnectedMtpDevices.cpp b/src/ConnectedMtpDevices.cpp
    index b0f569a..c6541e1 100644
    — a/src/ConnectedMtpDevices.cpp
    +++ b/src/ConnectedMtpDevices.cpp
    @@ -92,9 +92,17 @@ ConnectedDeviceInfo ConnectedMtpDevices::GetDeviceInfo(int index)
    info.bus_location = m_devs[index].bus_location;
    info.devnum = m_devs[index].devnum;
    info.device_flags = m_devs[index].device_entry.device_flags;
    - info.product = m_devs[index].device_entry.product;
    + if(m_devs[index].device_entry.product != NULL) {
    + info.product = m_devs[index].device_entry.product;
    + } else {
    + info.product = “UNKNOWN”;
    + }
    info.product_id = m_devs[index].device_entry.product_id;
    - info.vendor = m_devs[index].device_entry.vendor;
    + if(m_devs[index].device_entry.vendor != NULL) {
    + info.vendor = m_devs[index].device_entry.vendor;
    + } else {
    + info.product = “UNKNOWN”;
    + }
    info.vendor_id = m_devs[index].device_entry.vendor_id;

    return info;
    diff –git a/src/jmtpfs.cpp b/src/jmtpfs.cpp
    index 2d2eed4..ce7390d 100644
    — a/src/jmtpfs.cpp
    +++ b/src/jmtpfs.cpp
    @@ -32,6 +32,7 @@
    #include
    #include
    #include
    +#include

    #define JMTPFS_VERSION “0.4″

    • GWO says:

      Bugger … the HTML filter killed two references to <unistd.h>

      • Ed says:

        Hi ,

        I have problems with the date / time on the copied files. I use jmtpfs -0.3 on Fedora 18 with a Galaxy Note 3 .

        Transfers with file managers (Dolphin / Caja ) work, but the original file dates are not copied . All date / time on the copied files are new. Directories copied with the date “unknown.”

        Rsync is the result :

        ‘rsync: failed to set times on “My File”: Function not implemented (38)’

        I tried to compile jmtpfs – Version 0.4 to solve the problem, but I get an error :

        ” jmtpfs.cpp : In function ‘ int main (int, char ** ) :
        jmtpfs.cpp : 454:90 : error: ‘ getuid ‘ was not declared in this scope
        jmtpfs.cpp : 454:100 : error: ‘ getgid ‘ was not declared in this scope
        make: *** [ jmtpfs - jmtpfs.o ] Error 1 ”

        I hope you can fix these problems because jmtpfs works with the Galaxy Note 3 unlike other MTP file systems.

        • J Ferrara says:

          Try jmtpfs 0.5.

          When copying files to your device the original file dates won’t transfer over. MTP doesn’t provide any way to set the file date/times. But jmtpfs 0.4 and later pretend to set the dates so that programs like rsync will work without spewing lots of error messages.

  70. gilgamezh says:

    Thanks!! work ok in my Archlinux and Galaxy S3 Mini.

  71. Walt says:

    Hello, good work.

    Unfortunately on Fedora 19 x86_64 (after have installed libmtp-deve and file-devel) I receive:
    jmtpfs.cpp: In function ‘int main(int, char**)’:
    jmtpfs.cpp:454:90: error: ‘getuid’ was not declared in this scope
    context = std::unique_ptr(new MtpFuseContext(std::move(device), getuid(), getgid()));
    ^
    jmtpfs.cpp:454:100: error: ‘getgid’ was not declared in this scope
    context = std::unique_ptr(new MtpFuseContext(std::move(device), getuid(), getgid()));

    Thanks

    • J Ferrara says:

      Try version 0.5.

  72. Walt says:

    Only to add versions:

    libmtp-devel-1.1.6-0.fc19.x86_64
    libmtp-1.1.6-0.fc19.x86_64
    gvfs-mtp-1.16.3-2.fc19.x86_64

  73. Roland says:

    At first it worked flawlessly. (still unsure how)
    But while connected, I used “jmtpfs –help” (cancelled the new process) and since then it stopped recognizing it properly.
    Any hints on why?
    Thanks.

    • J Ferrara says:

      Oops. There is a bug where when running with –help or –version jmtpfs tries to connect to any attached devices. If the device is already in use by jmtpfs this will cause the device to hang. Fixed in jmtpfs 0.5.

      To recover when this happens, disconnect the device and then unmount the failed mount with “fusermount -u “. After this you should be able to reconnect the device.

  74. Philippe says:

    Thank you, I could not get a working MTP client for my Android phone until now.

    Got an error during build about getuid() and getgid() not being declared on jtmpfs.cpp line 454. All it took was to include unistd.h and sys/types.h, then everything worked.

    Tested jtmpfs-0.4 with a Galaxy S3 on Zenwalk Linux 7.2 with libmtp 1.1.6.

    Again, thanks a lot.

  75. Joe Pfeiffer says:

    Many thanks for writing this, and also to the people who’ve posted bug fixes in these comments — I ran into both the “need libmtp-dev” and the “need #include ” problems, and it was great to find the solution right here instead of needing to debug!

  76. Adrian Sandu says:

    On a fedora system (I’m running F20 now ) be sure do to
    yum install fuse-devel fuse libmtp-devel libmtp gcc-c++ file-devel
    And add…
    #include near the top of src/jmtpfs.cpp

  77. Sergey says:

    “Fixed in jmtpfs 0.5.”
    Where can I get version 0.5?

    https://github.com/kiorky/jmtpfs

    #define JMTPFS_VERSION “0.4″

  78. ändu says:

    jmtpfs made it to the Debian repository, and I just wanted to say: THANK YOU. Finally something that works. :-)

Trackbacks/Pingbacks

  1. Unlocking / Rooting the Samsung Galaxy Nexus - [...] only when used from the command line. Check out the wikipedia page for more Linux implementations. jMTPFs looks promising ...
  2. Jmtpfs: scambiare file tra dispositivi android 4 e linux | Prima o poi... - [...] dei file dal pc alla memoria dello smartphone e viceversa; ci viene quindi in soccorso jmtpfs, un filesystem fuse ...
  3. Mit jmtpfs MTP-Geräte wie das Galaxy Nexus oder das Samsung Galaxy SIII in Ubuntu mounten | Linux und Ich - [...] eine Lösung vorgestellt, die via FUSE einen MTP-Androiden ordentlich ins Dateisystem einbindet, jmtpfs ist nun eine weitere Lösung für Macs und ...
  4. Galaxy Nexus unter Ubuntu mounten - Android-Hilfe.de - [...] [...]
  5. Gestire dispositivi MTP in Linux (Nexus, Nexus 7, S3, xperia, etc.) « =====StranoStrano Blog!===== - [...] Io invece vi propongo di usare l’ottimo “jmtpfs” di Jason Ferrara che trovate qui. Ad oggi la versione è ...
  6. Access internal storage of Smart Phone in Ubuntu using gMTP - yCLICKit - [...] phone can be connected in MTP mode by using jmtpfs which is much more efficient and stable. We will ...
  7. Hello! Few questions - [...] A2109 Here is another mtp fuse solution that is in ...
  8. How to connect an Android device for file transfer on SLED 11 SP2 | SUSE Conversations - [...] Connecting my ASUS Transformer Android device via USB is fine via PTP for the pictures, however a bit flaky ...
  9. Upgrading the MTP Support on CentOS 6 | nuxref - [...] v1.1. libmtp v1.1 additionally builds against most peoples FUSE implementations such as MTPfs, jmtpfs and simple-mtpfs. It’s through these ...

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>