answered
2014-05-22 16:17:28 +0200
BIG RED BLINKING WARNING!!!!
THIS IS NOT AN OFFICIAL JOLLA SUPPORTED METHOD. USE AT YOUR OWN RISK!
ONLY DO THIS IF YOU KNOW WHAT YOU ARE DOING!
* END OF BIG RED BLINKING WARNING!!!!*
The following instructions will give you RW mass-storage on your device. You need to have developer mode enabled to do this.
as nemo :
dd if=/dev/urandom of=mass-disk bs=1024K count=100
mkdir usb-disk
as root (devel-su):
vi /etc/usb-moded/mass-storage-info.ini
content:
[mountpoints]
mount=/home/nemo/mass-disk
Then:
vi /etc/usb-moded/dyn-modes/mass_storage_android.ini
contents:
[mode]
name = mass_storage
module = none
mass_storage = 1
Now. Since we cannot make a vfat device on the device we need to use a pc.
First we need to have usb-moded read the new modes in and the UI to read them, so reboot.
Then plug in and see there is a mass-storage option if you have the settings on ask. This will give you a blank mass-storage device on the pc side.
dmesg shows this:
[1045849.351805] usb 3-2: Product: Sailfish
[1045849.351806] usb 3-2: Manufacturer: Jolla
[1045849.351807] usb 3-2: SerialNumber: DU3AM00210
[1045849.352850] scsi46 : usb-storage 3-2:1.0
[1045850.349140] scsi 46:0:0:0: Direct-Access Linux File-CD Gadget 0000 PQ: 0 ANSI: 2
[1045850.349828] sd 46:0:0:0: Attached scsi generic sg1 type 0
[1045850.352261] sd 46:0:0:0: [sdb] Attached SCSI removable disk
Here it is sdb, might be different for you.
sudo fdisk /dev/sdb
(It will give you a warning)
`Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x457c7be0.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): p
Disk /dev/sdb: 104 MB, 104857600 bytes
4 heads, 50 sectors/track, 1024 cylinders, total 204800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x457c7be0
Device Boot Start End Blocks Id System
We see it is the same size as we created earlier.
Now we format it. (or other format of choice, I only tried vfat)
sudo mkfs.vfat /dev/sdb -I
Unplug and replug (ignore the error for now) and see an empty vfat partition appear.
Now we fix the error shown on the UI, and at the same time make sure we can use the data in that parition on the phone.
Unplug and back to developer mode
Edit /etc/fstab and add this line:
/home/nemo/mass-disk /home/nemo/usb-disk auto rw,nosuid,nodev,users,umask=0000 0 0
This will remove the warning and make all the files on your usb disk visible to the OS. So you can store music on it and have it play in your car stereo with mass-storage, and when unplugged from your phone.
There, you should be done. If you want a bigger disk, increase count (100 gives you about 100Mb, so 1000 => 1GB, ...)
You can format it with another fs (ext4, ext3 and btrfs should work)
And again. At your own risk!
I'd be interested to use it for mounting disk images as usb storage. Same as DriveDroid does on Android.
Oliver ( 2014-01-04 15:11:19 +0200 )editI would also like to see mass storage implemented, even if only for the external sdcard. MTP might seem like an alternative, but this neglects the many devices which don't (and might never) support MTP, e.g. TV's, DVD players, routers, printers, etc. Mass storage basically transforms your phone into
Daniël ( 2014-01-26 20:03:40 +0200 )edita 'regular' USB-stick, which is the most common format for data interchange, and supported by the largest set of devices.
Daniël ( 2014-01-26 20:04:46 +0200 )editafaik when using usb mass-storage there cannot be concurrent access on the device. On the N9 it meant you couldn't access your files on the phone while connected using usb mass-storage. I can certainly understand why Jolla choose mtp, as it doesn't have these issues. But then again isn't Jolla using btrfs? In which case a temporary snapshot could perhaps be served over USB Mass Storage.
avdwoude ( 2014-02-03 21:27:15 +0200 )edit@avdwoude I think if the mass storage is emulated, there shouldn't be a problem with concurrent access, should there?
dsilveira ( 2014-05-22 16:32:29 +0200 )edit