Does MTP Help?
There doesn't seem to be a very good (functioning) way of mounting a Nexus 4 in Ubuntu, […]
I was wondering if you knew about the MTP protocol? It seems to be the main way for accessing media data of Android devices without SD cards via USB.
Modern Ubuntu versions (>= 13.04) should ship MTP support for Nautilus already. For older Ubuntu versions (e.g., 12.04) you might have to install a library upgrade manually or from a PPA.
You might also have to turn MTP support on in your Android device under “System settings” → “Storage” → “USB connection (PC)”
GVFS, FUSE, etc.
[…] I was thinking of writing some kind of adb wrapper, because adb works nicely. So my question is:
What are the layers/system parts between Nautilus/Nemo and a removable storage device and how do they work?
- How does a GUI file manager like Nautilus fetch folder contents and file details. Does it throw commands like
cd in the background?
There are a lot of different layers involved, but definitely Nautilus does not run those shell commands in the background; this would be way too slow.
The main layer you should look into for your project is GVFS. According to Wikipedia, “GVFS is the virtual filesystem for the GNOME desktop, which allows users easy access to remote data via SFTP, FTP, WebDAV, SMB, and local data via Udev integration, OBEX, MTP and others.”
Since GVFS has support for FUSE (which may be another interesting layer for our discussion), you might try something like adbfuse. It wraps ADB in a FUSE driver which can then be used by Nautilus via GVFS. Please note that I haven’t tried this, however, I would be interested in hearing about any experiences you might make with it :-)
- Which system part is in charge when you're browsing /media and how does it work? Can I place my own handler here somewhere?
I’m not entirely sure about this but I think udisks eventually makes sure that you see removable storage devices under
- Is what I'm thinking about possible at all?
It’s certainly possible as you can see with adbfuse; just run a web search for “fuse android adb” and you’ll get a few similar projects :-)