I am pulling my hairs on that. I want to access a MTP device via dbus interface. I see the service org.gtk.vfs.MTPVolumeMonitor. I can use d-feet to explore the interface org.gtk.Private.RemoteVolumeMonitor. But how on earth am I supposed to understand these excessive signatures of highly complex structures?
I already started to pull the repo of gvfs. I read the code. I still have no clue how to interpret the structures. I mean it’s not a problem of understanding the signature I get with org.freedesktop.DBus.Introspectable. But what is the variable name of each member of the structures. For example this one:
What is the meaning of all these strings and array? Is it just me too stupid to find that information? Or is it really like someone just dumped that interface without any documentation and you have to somehow know it’s structures?
I would be very grateful if someone could point to into the right direction.
After reading the documentation of gvfs a bit more I came across the statement that this dbus interface is for internal use only and thus it is not documented. This arises the question if I do the right thing.
Is there another way to access MTP devices? I know that gvfs creates a filesystem for MTP device. This is read-only. Therefore if you need to write files you need some kind of different interface to do a complete file transfer according to the MTP protocol.
Maybe there is a more simple dbus interface? KDE for example defines such an interface in it’s KIOD service. Anything similar for GNOME?
Why do you think that? For example, gvfs creates and mounts a fuse filesystem under /run/user/UID/gvfs and then my Android phone (MTP device) will show up there as something like /run/user/UID/gvfs/mtp:host=PHONEID. You can read/write files below that using normal (OS) operations.
OK, let’s try with gio (a simple CLI for libgio from glib2.0) - if you’re on Debian/Ubuntu it’s in package libgio-2.0-dev-bin. For my Android phone I see
will do the trick. Nemo (and Nautilus) probably use the functions from libgio, you can call them from the language of your choice (C, Python, Javascript…).
If that works, but not using the gvfs fuse filesystem: what’s your version of gvfs?
might be the fix (it was merged for gvfs 1.57.1, about some 4 months ago). But I have been copying stuff (just cp or Python shutil.copyfile) to my Android phone for years.
My version is 1.54. So it’s before the patch. Copy via GIO works. But of course only for the Gnome system. For KDE pendant would be kioclient.
So up to now my best bet is to listen on both DBus interfaces (kio and gvfs) and to hide the details from my application behind some abstract API. Bit frustrating that it is that complex, but at least it’s feasible.