On 11 Aug 2014, at 18:06, Dave Hylands <[email protected]> wrote:

> Thank you very much Chris.
> 
> From: "Chris Mills" <[email protected]>
> To: "Dave Hylands" <[email protected]>
> Cc: "Adrian Custer" <[email protected]>, [email protected]
> Sent: Monday, August 11, 2014 4:54:34 AM
> Subject: Re: [b2g] accessing the real SD card via DeviceStorage on newer 
> devices
> 
> Thanks Dave, for some really useful information. I’ve compiled it together 
> and added it to 
> 
> https://developer.mozilla.org/en-US/docs/Web/API/Device_Storage_API
> 
> When you get the chance, could you give the first couple of sections a read 
> through and let me know if anything sounds wrong?
> 
> Will do.

Great - cheers!

> 
> I also added information and useful links to 
> 
> https://developer.mozilla.org/en-US/docs/Web/API/Navigator.getDeviceStorages
> https://developer.mozilla.org/en-US/docs/Web/API/Navigator.getDeviceStorage
> 
> A couple of related questions:
> 
> 1. Are both the above Methods current, or is one being obsoleted? I can 
> understand the difference between both, but getDeviceStorages sounds like a 
> saner, better way to access the storage areas.
> 
> Yes - those 2 are both current since about 1.1 IIRC.

Great - I’ve updated the support table to include the specific Firefox OS 
version.

> 
> 2. In the getDeviceStorage page, the following text can be found:
> 
> "This method gives access to a unified view of all the storage area of a 
> given type. For example, if the sdcard storage area is requested on a device 
> with two SDCards available, the resulting DeviceStorage object gives access 
> to the files available on both cards at the same time.”
> which sounds like it contradicts your text about this method accessing the 
> storage type on the default storage area, as set by the user in their 
> settings app. Which is it? Has this changed recently?
> I think that there was a period of time that we did have that behaviour, and 
> then we changed it. So I would say that description is outdated. I think it 
> changed during the implementation of multiple storage areas, which would have 

Groovy - I’ve updated the description on the page to the current behaviour.

> 
> I tagged a bunch of device storage bugs as dev-doc-needed a couple weeks ago, 
> so I imagine a bunch of them can be knocked off with your work here.
> 

Ok, great! I’ll have a trawl through.

> Dave Hylands
> 
> 
> May thanks,
> 
> Chris Mills
>    Senior tech writer || Mozilla
> developer.mozilla.org || MDN
>    [email protected] || @chrisdavidmills
> 
> 
> 
> On 10 Aug 2014, at 03:25, Dave Hylands <[email protected]> wrote:
> 
> > Hi Adrian,
> > 
> > Yeah - I agree (about the unfortunate double use of sdcard).
> > 
> > Supporting "file" or "all" as an alias for sdcard sounds reasonable to me.
> > 
> > This would also impact the permissions in the manifest.
> > 
> > Dave Hylands
> > 
> > From: "Adrian Custer" <[email protected]>
> > To: "Dave Hylands" <[email protected]>
> > Cc: "Moz dev-b2g list" <[email protected]>
> > Sent: Saturday, August 9, 2014 7:29:05 AM
> > Subject: Re: [b2g] accessing the real SD card via DeviceStorage on newer 
> > devices
> > 
> > Hello,
> > 
> > Thanks for the explanation!
> > 
> > 
> > Now I think I understand it, it seems the API is using the same magic 
> > string, 'sdcard' for two different purposes. First it is the name of a 
> > storageType, used in navigator.getDeviceStorage/s( storageType ). Then 
> > it is also the storageName of the default internal storage:
> > 
> > const st = navigator.getDeviceStorage('sdcard'); //the storageType
> > const sn = st.storageName; //sn could be 'sdcard', the storageName
> > 
> > Unfortunate.
> > 
> > If the API were ever to evolve this should be resolved but until then we 
> > will have to fix the docs to prevent confusion. Probably the storageType 
> > should be called 'file' since it is storage for arbitrary files as 
> > against for 'music' or 'photo' types and the storageName is 'sdcard' for 
> > all.
> > 
> > Actually, would it be possible to add the 'file' storageType so we could 
> > deprecate the 'sdcard' storageType and drop it in the future?
> > 
> > cheers,
> >    ~adrian
> > 
> > 
> > 
> > 
> > On 8/8/14 10:17 PM, Dave Hylands wrote:
> > > There may be multiple storage areas.
> > >
> > > You can call navigator.getDeviceStorages(type) to get back an array
> > > of all of storage areas.
> > >
> > > Each storage area will have a name, retrievable using .storageName
> > > attribute.
> > >
> > > If there is more than one storage area, then the internal one will be
> > > named 'sdcard' and the physical storage are will be called something
> > > else (sometimes, it's extsdcard, sometimes its sdcard1).
> > >
> > > navigator.getDeviceStorage() returns the storage area whose .default
> > > attribute is true. This is controlled by the user in Settings->Media
> > > Storage->"Default media location" (way down at the bottom). If you
> > > call addNamed and pass in a relative path, then it will be stored on
> > > the default storage area. The onsuccess callback will get the fully
> > > qualified name (for example /sdcard/filename) where the file was
> > > actually stored.
> > >
> > > The names of files on the sdcard storage area will be
> > > /sdcard/path/filename, and the names of files on the sdcard1 storage
> > > area will be /sdcard1/path/filename
> > >
> > > Note that the /sdcard and /sdcard1 are storage names. Their actual
> > > mount points on the system are determined via vold and/or
> > > /system/etc/volume.cfg file). DeviceStorage transparently maps the
> > > storageName into the actual mountPoint (so you don't need the mount
> > > point if you're just accessing the files through device storage)
> > >
> > > If you want to determine the mount point to examine the filesystem
> > > from an adb shell, then you can determine the vold mount points by
> > > using the command: adb shell vdc volume list (requires a root shell)
> > >
> > > On the flame, you'll see something like: 110 0 sdcard /storage/sdcard
> > > 4 110 0 sdcard1 /storage/sdcard1 4 200 0 Volumes listed.
> > >
> > > For volumes which aren't managed by vold (the sdcard volume on a
> > > nexus 4/5 are examples of this), the mount point is found in
> > > /system/etc/volume.cfg
> > >
> > > With the engineering builds, there is a ds-test app
> > > (gaia/dev_apps/ds-test) which I use for testing things on device
> > > storage.
> > >
> > > Dave Hylands
> > >
> > > ----- Original Message -----
> > >
> > >> From: "Adrian Custer" <[email protected]> To: "Moz dev-b2g list"
> > >> <[email protected]> Sent: Friday, August 8, 2014 5:06:41
> > >> PM Subject: [b2g] accessing the real SD card via DeviceStorage on
> > >> newer devices
> > >
> > >> Hey all,
> > >
> > >> is there a way to access the actual SD card on newer devices using
> > >> navigator.getDeviceStorage('....')?
> > >
> > >> While older devices had /sdcard (or really /mnt/sdcard) to access
> > >> the external SD card, the trend seems to be to have that location
> > >> reference built in ROM and have a secondary location for the SD
> > >> card. For example, the TCP tablet has:
> > >
> > >> root@android:/ # df Filesystem Size Used Free Blksize /dev 797M 32K
> > >> 797M 4096 /mnt/secure 797M 0K 797M 4096 /mnt/asec 797M 0K 797M
> > >> 4096 /mnt/obb 797M 0K 797M 4096 /system 1G 172M 1G 4096 /cache 1G
> > >> 102M 1G 4096 /data 126M 89M 36M 4096 /mnt/sdcard 9G 84M 9G 4096
> > >> /mnt/secure/asec 9G 84M 9G 4096 /mnt/extsd 29G 4G 25G 32768
> > >
> > >> where the /mnt/sdcard is some internal block of memory and the
> > >> /mnt/extsd is the 32GB SD card in the card slot.
> > >
> > >> Gaia seems to be aware of these two spaces and may be using them
> > >> for different purposes since I have :
> > >
> > >> root@android:/ # ls /mnt/sdcard/ DCIM Documents LOST.DIR ...
> > >> root@android:/ # ls /mnt/extsd/ DCIM LOST.DIR Music Pictures ...
> > >
> > >> although maybe I added the directories by hand to the external SD
> > >> card, I don't remember. The music app can access the music files on
> > >> the card though, not sure how.
> > >
> > >> The doc page
> > >
> > >> https://developer.mozilla.org/en-US/docs/Web/API/Navigator.getDeviceStorage
> > >
> > >>  does not mention anything.
> > >
> > >> thanks for any info, ~adrian
> > >> _______________________________________________ dev-b2g mailing
> > >> list [email protected]
> > >> https://lists.mozilla.org/listinfo/dev-b2g
> > >
> > 
> > 
> > _______________________________________________
> > dev-b2g mailing list
> > [email protected]
> > https://lists.mozilla.org/listinfo/dev-b2g

_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to