Skip to content

gvfs MTP backend update

Hi again,

It’s been quite a while since I wrote my gvfs MTP backend work, but that doesn’t mean nothing has happened in the meantime. Since then, I’ve improved the functionality quite a bit, including submitting patches to libmtp to support grabbing thumbnails and detecting “Add Storage” events (which you want to do so that when someone unlocks their phone, the phone storage automatically appears). I’ve also started the review process for submitting upstream (See GNOME Bug 666195), so hopefully we’ll see it upstream in the next couple of months.

More practically, and the main reason for writing this post, I’ve finally got around to setting up a ppa to host builds of gvfs with my patches applied. Learning how to set up a ppa was interesting, and pretty painless – so the end result is working packages for Ubuntu 12.10. Note that due to 12.10 only including libmtp 1.1.4, neither of the features I mentioned above is enabled in these builds (so you’ll have to refresh your nautilus window after unlocking). Perhaps I’ll throw a build of 1.1.5 in there too at some point.

You can find the ppa here. Enjoy!

{ 24 } Comments

  1. hbt | 2nd December 2012 at 23:06 | Permalink

    Great! Thanks for working on this. Anybody got a Fedora repo for this?

  2. Ernst | 4th December 2012 at 03:13 | Permalink

    It’s not possible to build for Ubuntu 12.04?

  3. Philip Langdale | 4th December 2012 at 20:54 | Permalink

    The patch applies to gvfs 1.12 in 12.04 but I don’t have a build environment available.

  4. Tom Hargreaves | 9th December 2012 at 01:58 | Permalink

    What is the review process for submitting upstream? I opened https://bugzilla.gnome.org/show_bug.cgi?id=679051 months ago and have heard nothing. Based upon others’ experience (e.g. https://mail.gnome.org/archives/gvfs-list/2010-July/msg00001.html) I assumed the gvfs developers were just hard to get a response from, but since you are getting useful feedback clearly I’m doing something wrong. But what? I have other webdav patches but it seems pointless to open bugs for them if I can’t even get one-liners applied.

  5. Ernst | 9th December 2012 at 07:17 | Permalink

    So I’ve played around with it a bit now and it seems to work as advertised! Very snappy.

    Next step, make it work with media programs like Shotwell and Rhythmbox?

  6. Philip Langdale | 9th December 2012 at 21:50 | Permalink

    Ernst,

    What needs to happen to other apps depends on what exactly those apps do. Something like shotwell or eog probably just needs to handle non-random-access gvfs backends better (eg: evince will automatically copy pdf files over when you try to open them). Rhythmbox, as a media player probably needs native support, and it’s one of the apps that’s written using the API that doesn’t work, and it will need rewriting. There’s also a wider problem that MTP only supports one client at a time, so all the MTP interaction really needs to be put in a daemon for applications to share.

  7. Philip Langdale | 9th December 2012 at 21:52 | Permalink

    Tom,

    Don’t know what to say. I expect it’s an issue of visibility. The broken MTP story has been relatively high profile, as anyone with a recent android phone is suffering from it. webdav is not used as much. You can certainly email some of the devs directly to point out your stalled patched.

  8. Lubosz | 30th December 2012 at 07:36 | Permalink

    Thank you for working on this! Every distro needs this ASAP. I hope this will get upstream quickly.

    I have made an AUR package for Arch Linux:
    https://aur.archlinux.org/packages/gvfs-mtp-git

    https://wiki.archlinux.org/index.php/MTP#gvfs-mtp

  9. Murry | 3rd January 2013 at 02:27 | Permalink

    Hello Philip,

    could you update your ppa with the lates git and a backport for libmtp 1.1.5 from raring?

    I tried your packagde with my Samsung S3 i9300 and Ubuntu 12.10. Sometimes it works and sometimes not. Often I get a error message that nautilus can’t mout, but then it works.

    Can I help you with log files or some testing?

    Thanks for the work,

    Murry

  10. Murry | 3rd January 2013 at 08:38 | Permalink

    Hello Philip,

    I found libmtp 1.1.5 in a different ppa and I recompieled your package.

    Now it works fantastic with my Samsung S3 I9300,

    I hope it goes upstream very fast.
    Please update your ppa without libmtp 1.1.5 it doesn’t work.

    Thanks a lot,

    Murry

  11. Philip Langdale | 3rd January 2013 at 11:03 | Permalink

    Murray,

    You don’t need to recompile against 1.1.5 to enable any essential features (it’ll give you unlock event detection as I discussed, but otherwise works fine). If you need to upgrade to 1.1.5 to fix/enable low level support for a particular phone, you can just upgrade libmtp and leave my ppa packages as-is.

    I will be updating the ppa packages once I’ve finished incorporating all the review feedback I’ve received.

  12. Murry | 4th January 2013 at 01:01 | Permalink

    Hi Philip,

    thanks for updating your ppa and the new Version.

    First Test with Nexus7 (lbmtp and gvfs from your ppa)

    Bussy with build icons from pdfs and try to copy a file:
    Fehler beim Kopieren von ┬╗Wonders_of_Nature.mp4┬ź.
    Beim Kopieren der Datei nach mtp://[usb:001,003]/65537/8 ist ein Fehler aufgetreten.
    libmtp error: Could not send object info.

    Crash with:
    gvfs-mtp crashed with SIGSEGV in g_type_cjeck_instance_is_a()

    Copy of a folder with files result in a emty folder (a saw the transfer of the files)

    Copy of a folder with a sub folder result error message: libmtp error: Could not send object info.

    Sometimes Nautilus close with message: connection closed

    All copy of files without any problems!

  13. Murry | 4th January 2013 at 01:17 | Permalink

    Hi Philip,

    Test Samsung Galaxy S3:

    same results as with the Nexus7.

    Problems with copy of folders to the device. Sometimes connection lost. Copy of files are OK.

    Are there logs which I can send to you?

    Regards,

    Murry

  14. Philip Langdale | 4th January 2013 at 09:54 | Permalink

    Hi Murray,

    Copying directories to the device doesn’t work. I discussed this in the commit log and the bugzilla bug. It’s something I know how to fix but it will take time.

    I’m not sure what you’re describing in your other error situations. What did you do when you got it to crash?

    MTP only allows one operation at a time, so if it’s busy downloading PDF files to make icons (and yes, it downloads the whole file) then it can’t download files normally. So the error might be due to that timing out. It might also be because the file isn’t on the device anymore. If the media database on the phone is out of date, it can report files that don’t exist

  15. Murry | 4th January 2013 at 11:55 | Permalink

    Hi Philip,

    thanks for the explanatiins. I will try to find out when nautilus say the connection is closed.

    Is it possible to support the feature “make a new folder”? Nautilus told me that this is not supportet.

    Can you prevent that Nautilus try to copy a folder?

    Great work!

    Murry

  16. Philip Langdale | 4th January 2013 at 13:11 | Permalink

    Hi Murray,

    I’ve found the crashing problem – there’s a bug in how thumbnail icons are handled. I’ll fix that.

    I don’t understand your problem with “Make a new folder” – that works fine for me.

  17. Murry | 5th January 2013 at 00:47 | Permalink

    Hi Philip,

    the new version run very stable with the nexus7. I got no connection closed message.

    - “Make new folder” working. After rename, the folder is not visible, pressing F5 fix this.
    - File copy: OK (both directions)
    - File and Folder (with and without files) delete: OK.
    - Feels a little bit slower but stable

    Now is it usable! Great!

  18. Murry | 5th January 2013 at 07:25 | Permalink

    Hi Philip,

    same good results with my Samsung Galaxy S3. I think it works a little bit fast than with the Nexus7. No connection problems any more. The external SD-Card is slower. This cause some stops at a large File (600 MB ISO).
    With rename folders is the same as with the Nexus (F5 shows the renamed folder).

    The Lubuntu Filemanger (PCmanFM) has a Problem with the filenames. When I copy a file to the computer it get a new name (a number).

    Best wishes,

    Murry

  19. Philip Langdale | 5th January 2013 at 09:11 | Permalink

    Hi Murray,

    I’m glad its working. The PCmanFM problem is because PCmanFM is not reading the correct “filesystem filename” property. It needs to be fixed on their side.

  20. Philip Langdale | 5th January 2013 at 10:30 | Permalink

    Murray, I needful be more precise about the wrong filename problem. The file manager should read the “copy name” attribute to get the right filename.

    I also tested thunar and it doesn’t show a mount point but you can put in the mtp url and it will show up. It also has the copy name problem.

  21. Greg | 6th January 2013 at 06:20 | Permalink

    Hi Philip,

    thanks for all your efforts so far, and from the comments I gather it’s working for many people. It doesn’t do it for me though – either nautilus just doesn’t mount anything or it mounts but shows no content. Is there *any* way to debug this? I tried gvfs-ls MTP-URL as gotten from gvfs-mount -l -i but it always fails with a “not mounted” error.

    I’m on Ubuntu 12.10. Trying with a Samsung S3 i9300 (no custom rom).

  22. Greg | 6th January 2013 at 06:42 | Permalink

    Might I need a special udev entry? Currently I see these entries:

    $ grep 4e8 /lib/udev/rules.d/*|grep 6860
    /lib/udev/rules.d/40-libgphoto2-2.rules:ATTRS{idVendor}==”04e8″, ATTRS{idProduct}==”6860″, ENV{ID_GPHOTO2}=”1″, ENV{GPHOTO2_DRIVER}=”proprietary”, ENV{ID_MEDIA_PLAYER}=”1″, MODE=”0664″, GROUP=”plugdev”
    /lib/udev/rules.d/69-libmtp.rules:ATTR{idVendor}==”04e8″, ATTR{idProduct}==”6860″, SYMLINK+=”libmtp-%k”, MODE=”660″, GROUP=”audio”, ENV{ID_MTP_DEVICE}=”1″, ENV{ID_MEDIA_PLAYER}=”1″

    I’m worried about the entry tying the S3 with gphoto…

  23. Philip Langdale | 6th January 2013 at 07:43 | Permalink

    Hi Greg,

    If you’re using my latest built with libmtp 1.1.5 it should be fine.

    Did you restart after installing the ppa packages? Did you unlock the phone?

  24. Greg | 8th January 2013 at 11:35 | Permalink

    Philip – thanks for the response. It works now as advertised, I somehow totally missed the unlocking bit. Sorry for the noise, and thanks again for this extremely valuable contribution. Great job!

Post a Comment

Your email is never published nor shared. Required fields are marked *