Ubuntu: Is the ubuntu phone filesystem mountable via a usb connection?



Question:

Is the ubuntu phone filesystem mountable in linux via a usb connection? Is there reason to believe this feature is here to stay? For me rather than full desktop/phone convergence, I'd be happy with being able to use my phone as the place I store all my essential data (as in a usb stick) and then use it on my phone or share it with my laptop whenever I need to.


Solution:1

Ubuntu Touch lets you access the file system via the MTP protocol, but does not support USB Mass Storage mode. In this respect, it is similar to newer Android devices and is unlikely to change. Out of the box, you should be able to access files on the phone using any GVFS aware application.

There is a good reason why many smart devices have been moving away from mass storage mode as a way of performing file transfer: mass storage mode involves exposing a block device, while MTP exposes a file system.

Unless a file system is specially designed, only one OS should access the underlying block device at a time. FAT is not designed for this use case, which is why older Android phones that supported mass storage mode would unmount the SD card before making it available over USB.

In contrast, with MTP the phone is the only thing accessing the underlying block device, and the connected computer instead makes file system level requests over USB (e.g. list directory, download or upload a file, etc). This means you can continue to use the device while it is connected.


Solution:2

Unless a file system is specially designed, only one OS should access the underlying block device at a time. FAT is not designed for this use case, which is why older Android phones that supported mass storage mode would unmount the SD card before making it available over USB.

I don't see the point here. Yes, it should only used by one device at a time and that's why it is unmounted on the phone before it is accessible from the computer. What's the issue? Unless you want to watch a movie from the external MicroSD while you are copying files.

Also ... you don't have to use MTP very long to realize that it does not work all that well. Background processes don't sync when you expect them to. You cannot see thumbnails of your images. Transfer is slow. Another POC is pushed on users under the disguise of a a good 'user experience'. The same argument that Apple uses to completely lock everybody into their own 'ecosystem' to the point where you cannot even insert a MicroSD or change a battery on your own.


Solution:3

On BQ E5 Ubuntu Edition with Ubuntu Touch 15.04 (r4) I can unmount the external sdcard and switch the usb-port to mass storage mode with the script massStorage.sh and switch the usb-port back to mtp with the script mtp.sh.

Content of sript massStorage.sh:

#!/bin/sh    echo 0 > /sys/class/android_usb/android0/enable  cp /sys/class/android_usb/android0/functions /tmp/massStorageFunctions  echo mass_storage > /sys/class/android_usb/android0/functions  umount /dev/mmcblk1p1  echo /dev/mmcblk1 > /sys/devices/virtual/android_usb/android0/f_mass_storage/lun/file  cp /sys/devices/virtual/android_usb/android0/f_mtp/device/idVendor /tmp/massStorageVendor  cp /sys/devices/virtual/android_usb/android0/f_mtp/device/idProduct /tmp/massStorageProduct  echo 03f0 > /sys/devices/virtual/android_usb/android0/f_mass_storage/device/idVendor  echo 5607 > /sys/devices/virtual/android_usb/android0/f_mass_storage/device/idProduct  echo 1 > /sys/class/android_usb/android0/enable  

Content of script mtp.sh:

#!/bin/sh    if [ -f /tmp/massStorageFunctions ]; then      echo 0 > /sys/class/android_usb/android0/enable      cp /tmp/massStorageFunctions /sys/devices/virtual/android_usb/android0/functions      cp /tmp/massStorageVendor  /sys/devices/virtual/android_usb/android0/f_mass_storage/device/idVendor      cp /tmp/massStorageProduct /sys/devices/virtual/android_usb/android0/f_mass_storage/device/idProduct      sudo -u phablet udisksctl mount -b /dev/mmcblk1p1      echo 1 > /sys/class/android_usb/android0/enable  fi;  

Note, that the vendor and product ids are stolen from another usb-mass storage device.

I have saved these scripts in the directory ~phablet/bin. Furthermore, I have defined the following aliases for starting the scripts from the com.ubuntu.terminal command line:

alias u='sudo sh ~phablet/bin/massStorage.sh'  alias m='sudo sh ~phablet/bin/mtp.sh'  

You can set these aliases in the .bashrc-file within the home directory of phablet.

Note, that you must input your pin to detach/attach the sd-card with these scripts.


Remark: One big problem with the alternative solution mtp proposed by the others is that it is not available from within cygwin. One can use mtp within windows but the mtp devices are not provided as a drive letter which is needed for cygwin. I have essentially the same use case as Tor Thommesen and found this solution to expose my secondary sd-card of the phone as mass storage device.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »