Freebsd – Mount MTP device in FreeBSD

freebsdfusemtp

I have an Android tablet which uses MTP instead of USB Mass Storage for transferring files. I'd like to mount it in a FreeBSD machine.

I tried the method described here.

  1. I installed mtpfs by going to /usr/ports/sysutils/mtpfs and running make install clean as I usually do to install ports.

  2. I enabled FUSE support by adding fusefs_enable="YES" in /etc/rc.conf.

  3. I also added fuse_load="YES" to /boot/loader.conf. (This is not in the original procedure, I was trying to get it to work)

  4. Added vfs.usermount=1 to /etc/sysctl.conf.

  5. After that, I rebooted the machine.

I tried to mount the tablet by running mtpfs /mnt/. As a non privileged user I receive a 'Permission denied' message. As root it apparently works. But cd'ing into the directoy I receive a 'Not a directory' message, which is the same problem described in the linked thread. I'm assuming there is something left out of the original instructions.

If there's any alternative to mtpfs, I'm also interested in hearing about that.

Best Answer

I just tried port fusefs-simple-mtpfs. Here are simple-mtpfs instructions. Works like a charm (with my Windows Phone 8 smartphone):

g@crayon2:/mnt % l /mnt/
drwxrwxr-x   2 g     g           0  1 Jan  1970 test/

g@crayon2:/mnt % simple-mtpfs /mnt/test/
g@crayon2:/mnt % l test/
total
0
drwxrwxr-x  2 g  g  0 14 Feb  2015 Documents/
drwxrwxr-x  2 g  g  0 14 Feb  2015 Downloads/
drwxrwxr-x  2 g  g  0 11 Oct  2014 Music/
drwxrwxr-x  2 g  g  0 19 Nov  2014 Pictures/
drwxrwxr-x  2 g  g  0  6 Mar  2013 Ringtones/
drwxrwxr-x  2 g  g  0 25 Oct 16:01 Videos/

This is the content of /etc/devfs.rules on my desktop (which affects which devices the user can mount):

[system=10]
add path 'usb*'          mode 0770 group cups
add path 'ugen*'         mode 0660 group cups
add path 'ad[0-9]\*'     mode 0666
add path 'ada[0-9]\*'    mode 0666
add path 'da[0-9]\*'     mode 0666
add path 'acd[0-9]\*'    mode 0666
add path 'cd[0-9]\*'     mode 0666
add path 'xpt[0-9]\*'    mode 0666
add path 'mmcsd[0-9]\*'  mode 0666
add path 'pass[0-9]\*'   mode 0666
add path 'usb/\*'        mode 0666
add path 'ugen[0-9]\*'   mode 0666

These rules are enabled in /etc/rc.conf so that they are active when the system starts:

devfs_system_ruleset="system"
Related Question