Another Way (Maybe) to Skin The MTP Cat

I knew there was a nexus between MTP and PTP but I hadn’t checked to see if I could use libgphoto2 to access my Samsung S3 before today. I decided to check because I saw the S3 listed among the devices supported by libgphoto2. Imagine that.

I’d already installed gtkam, which uses libgphoto2, to manage my old Kodak digital camera. I looked to see if the S3 was among the “cameras” listed in the camera selection dialog. It wasn’t listed there but several similar Samsung models were. I didn’t have anything to lose so I plugged it in. I then ran the “detect” option and, voila, I had a listing for my MTP device. I expanded the entry and I had access to everything on the device.


What gets me is that this (in #!/Jaunty) is the current version of gtkam and libgphoto2 2.4.2 (current is 2.4.6 and the S3 is named among supported devices in that version). Even with the current version of libmtp, I don’t have the ability to see things by directory (not shown but take my word for it: “Datacasts” and all  the other directories are listed above this “Music” directory) when using apps like rhythmbox. My only option is to use mtp-tools (aka “mtp-examples” to those of you still hitting my blog searching for Fedora help). The only options I have in rhythmbox are to view by artist, song, album, etc. Useful but limited. At least mtp-tools is adequate to manage the device.

I haven’t looked to see if there are any other apps using libgphoto2 to manage MTP devices or to allow mounting them via fuse. Speaking of fuse, the version of mtpfs in Jaunty’s repositories is of no use to me. I can mount the device but a command like ls results with question marks rather than file sizes and permissions. It also shows the filenames but doesn’t allow any other operation on them.

Anyway, it’s nice to see there might be another way to use MTP devices under non-Windows operating systems and that it may actually yield better results. Of course, I’ve only tried to read files and directories and delete files. It may be back to square one if I try to add files.

UPDATE: I installed gphotofs, a fuse system for libgphoto2 which allows PTP/MTP cameras to be mounted as any other filesystem. Yes! I can mount the device and have full access of it. Just deleted a bunch of podcasts from the Datacasts directory.


My shell, mksh, carries text beyond the screen (<) so you can’t see the rm command but you can see the result. Finally something freaking works right.

UPDATE 2: Add another 16MB (27MB when various {u} dependencies are removed) of cruft removed. Gone are rhythmbox, libmtp, libusb-dev (needed to recompile libmtp), mtp-tools, mtpfs, etc. It’s redundant to gphoto2/gphotofs and I have much better access to my device now.

UPDATE 3: Using gphotofs is very easy, especially if you’ve used fuse before. You need to be in group plugdev. I chose to create a mount point in my home directory (~/mtp) rather than use a point like /mnt. To mount, first make sure fuse is loaded (lsmod if it was built as a module) and then use the gphotofs command:

gphotofs ~/mtp

Or whatever your mount point is. Once mounted, you can navigate and issue commands as you would any other directory (in a terminal, file manager, whatever you want). When finished, unmount the point:

fusermount -u ~/mtp

Or whatever your mount point is. Give it a moment to umount and then you can remove your device. It’ll work for your camera (if the camera is MTP or PTP) as well.

UPDATE 4: Fuck. If it’s too good to be true, it probably is. I can read from the device and copy and delete from it. Copying to it:

cp: cannot create regular file... Function not implemented

So tomorrow I reinstall libmtp and mtp-tools. Yippee.


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: