Closed Bug 1090271 Opened 10 years ago Closed 6 years ago

Cannot share SD card storage over USB in 2.1 if the external storage name is not registered for enabled UMS.

Categories

(Firefox OS Graveyard :: Gaia::Settings, defect)

All
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(b2g-v2.1 affected, b2g-v2.2 affected, b2g-v2.2r affected, b2g-master unaffected)

RESOLVED WONTFIX
Tracking Status
b2g-v2.1 --- affected
b2g-v2.2 --- affected
b2g-v2.2r --- affected
b2g-master --- unaffected

People

(Reporter: m.parker.17, Unassigned)

Details

(Keywords: regression)

Attachments

(4 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:35.0) Gecko/20100101 Firefox/35.0
Build ID: 20141027004000

Steps to reproduce:

I'm running a Geeksphone Peak GP-201 with an 8GB SD card inserted... more info:

* Hardware: Geeksphone Peak GP-201 (fx)
* OS Version: 2.1.0.0-prerelease
* Hardware Revision: qcom
* Platform Version: 34.0
* Build identifier: 20141027092348
* Update Channel: nightly-geeksphone
* Git commit info: 2014-10-24 21:57:55 c97463d6

I usually put podcasts on the SD card so I can listen to them in the Music app.

Last week, I upgraded from Firefox 2.0 to 2.1 after the Homescreen app crashed and some of the built-in App icons disappeared from the homescreen. Initially, when prompted by the Geeksphone tool to erase my user settings, I chose not to, but after the upgrade, the icons were still missing, so I re-flashed and erased all user settings.

After the upgrade, the phone still sees all of my documents and music on the SD card. However, when I connect my phone to my computer using USB and enabled USB Storage in the Firefox Settings app, only the phone's Internal storage device is available for my computer to mount (I've tried this in Mac OS/X 10.10, Ubuntu 14.04 and Arch Linux).

It was possible in FFOS 2.0 (and as far back as FFOS 1.2, I think) to go to Settings -> Media Storage and, for each storage device (Internal Storage and SD Card Storage), toggle whether to "Share [the storage device] using USB".


Actual results:

When I tried going to Settings -> Media Storage in Firefox OS 2.1, I don't see a "Share using USB" toggle and cannot find another way to share the SD card using USB.


Expected results:

I expected there to be *some* way to share the SD card using USB.
Added screenshot of the control that's missing in 2.1 but present in 2.0 (taken in an emulator). I've highlighted the control in a red box.
OS: All → Gonk (Firefox OS)
Hi M Parker, can you help to provide some log?
howie, what kind of log are you looking for?
Hi Parker,
there is UX change in 2.1.

we share internal storage and sd card in the same time.
(Settings -> Storage -> toggle USB Storage)
Alphan, when I turn on USB storage, my computer sees my phone's internal storage, but not the SD card. The SD card used to show up as a separate mountable volume, but after the upgrade to 2.1, it doesn't show up at all.

I have looked through the folders on the internal storage: there is an "external_sd" folder, but it does not contain the contents of my SD card (i.e.: the SD card is not mounted there).

My USB storage Transfer Protocol is set to "USB mass Storage (UMS)".
could you share logcat for analysis?

command:
adb shell logcat -v threadtime > logcat.txt
Alphan, sorry for the delay...

I was initially very confused by your request because I didn't understand how it was possible to generate logs for a UI control that doesn't exist anymore.

Eventually, I thought of logging the following sequence of events:

1. Enable USB sharing on my phone,
2. Allow my computer's operating system to mount my phone's internal storage (I was using my Mac OS/X 10.10 machine),
3. Browse through the folders on the mounted drive from my computer,
4. Eject the mounted drive from my computer, and,
5. Disable USB sharing on my phone.

I hope this is the sort of thing you were looking for.
There is discussion of the same problem.
https://groups.google.com/forum/#!topic/mozilla.dev.b2g/rY0vo2wJEf4

From log, there are two volumes called sdcard and emmc.
Sdcard is shared but emmc. (emmc is not recognized by gaia)
11-06 08:56:37.189   123   244 I AutoMounter: UpdateState: Volume sdcard is Shared and inserted
11-06 08:56:37.189   123   244 I AutoMounter: UpdateState: Volume emmc is Mounted and inserted @ /mnt/emmc gen 2 locked 0 sharing dis


I think it will work if we rename the emmc to sdcard1.
By the way, it is weird that we called sdcard as emmc, isn't it?

You can try to modify vold.fstab (rename emmc into sdcard1)
https://github.com/mozilla-b2g/device-gp-keon/blob/master/vold.fstab


The following result is from our reference device. (Flame)
adb shell vdc volume list
110 0 sdcard /storage/sdcard 7          -> internal storage
110 0 sdcard1 /storage/sdcard1 7        -> external storage (sdcard)
Yes, that works for me. How do we get Geeksphone to apply that to their images?
Thanks everyone!

I can confirm that the SD card is mounted as /etc/emmc :

$ ./adb.mac shell vdc volume list
110 sdcard /mnt/sdcard 4
110 emmc /mnt/emmc 4
200 Volumes listed.

... and that, when I...

$ adb shell ls /mnt/emmc

... I can see the contents of my SD card.

***

http://support.geeksphone.com/ has an e-mail form to contact the Geeksphone support staff. I have sent an e-mail that says:

> Hello Geeksphone support team,
> 
> I've been working with some members of the Firefox OS community to troubleshoot a regression in Firefox OS 2.1 where the SD card I inserted in my Geeksphone Peak doesn't get shared with my computer. 
> 
> It seems that, when the SD card is mounted, it is named "emmc" instead of "sdcard1", and is therefore not recognized as a mountable device. It may be possible to fix this by a simple modification to the default fstab file.
> 
> I am contacting you in the hope that you can fix this for all Peak users who upgrade to Firefox OS 2.1.
> 
> You can see the full bug report and possible solution here: https://bugzilla.mozilla.org/show_bug.cgi?id=1090271
> 
> thanks very much,
> -- M Parker

If I don't get a response in a week, I will post on the Peak Bugs board on the Geeksphone forums website: http://forum.geeksphone.com/index.php?board=52.0

If Geeksphone don't update this bug themselves, I'll do what I can to keep the comments up-to-date for everyone else experiencing this problem.
@M Parker

I won't only may be possible, I tried it and if you rename it from emmc to sdcard1 it definitely works.

This is the fixed vold.fstab:
> # Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
> #
> # Redistribution and use in source and binary forms, with or without
> # modification, are permitted provided that the following conditions are
> # met:
> #     * Redistributions of source code must retain the above copyright
> #       notice, this list of conditions and the following disclaimer.
> #     * Redistributions in binary form must reproduce the above
> #       copyright notice, this list of conditions and the following
> #       disclaimer in the documentation and/or other materials provided
> #       with the distribution.
> #     * Neither the name of Code Aurora Forum, Inc. nor the names of its
> #       contributors may be used to endorse or promote products derived
> #       from this software without specific prior written permission.
> #
> # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
> # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
> # ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
> # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
> # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
> # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
> # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
> # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
> # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
> # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> 
> dev_mount sdcard /mnt/sdcard 18 /devices/platform/msm_sdcc.3/mmc_host/mmc0
> 
> dev_mount sdcard1 /mnt/emmc auto /devices/platform/msm_sdcc.1/mmc_host
The setting ums.volume.VOLUMENAME.enabled determines whether a particular volume is shared with the PC.

The defaults for these are set in file gaia/build/config/common-settings.json

I don't see a ums.volume.emmc.enabled so that's probably why the volume isn't being shared.
As Dave mentioned in comment 12, there is no specific key for Geeksphone Peak GP-201 to enable UMS on PC.

And now, we already have three specific key name('sdcard1', 'extsdcard', 'external') for different devices. 
https://github.com/mozilla-b2g/gaia/blob/master/build/config/common-settings.json#L230-L232

I don't think this is a good solution for service each devices. We have to add the 'specific' name each time. Before find out a better way to overcome the problem, we have to add 'ums.volume.emmc.enabled' key for Peak. Because there are still many people using geek phone.

Alphan and Dave, shall we create a bug for porting different devices to enable UMS via general API solution? I'm not sure it's possible or not.
Flags: needinfo?(dhylands)
Flags: needinfo?(alchen)
Hi Ian,
in my opinion, maybe we can provide a API which return the name of volumes. 
(ex: on flame,the API will return sdcard,sdcard1)
Then gaia can use these name to enable UMS.
Is this way a general API for you?

Hi Dave,
what's your opinion?
Thanks.
Flags: needinfo?(alchen)
There used to be UI in the settings app to control it, but the UI was removed, and no bugs were filed to have the underlying code changed.

In order to match the UI, I propose that we modify the code as follows:

if the settng ums.volume.VOLUMENAME.enabled exists, use that setting
if the setting doesn't exist, use the setting for ums.volume.sdcard.enabled instead.
Flags: needinfo?(dhylands)
(In reply to Alphan Chen[:Alphan] from comment #14)
> Hi Ian,
> in my opinion, maybe we can provide a API which return the name of volumes. 
> (ex: on flame,the API will return sdcard,sdcard1)
> Then gaia can use these name to enable UMS.
> Is this way a general API for you?
> 
Alphan, I forget that deviceStorage API already has provided name property in the return of volume. And Gaia composed the key name via to enable UMS mode in v2.0(https://github.com/mozilla-b2g/gaia/blob/v2.0/apps/settings/js/media_storage.js#L360-L374). 

This is a regression since we removed code base to sync new UI without toggled USM mode for each volumes. The issue is able to be reproduced if the external device name is not part of them.

   "ums.volume.sdcard1.enabled": true,
   "ums.volume.extsdcard.enabled": true,
   "ums.volume.external.enabled": true,
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: regression
Summary: Regression: Cannot share SD card storage over USB in 2.1 → Cannot share SD card storage over USB in 2.1 if the external storage name is not registered for enabled UMS.
(In reply to Dave Hylands [:dhylands] from comment #15)
> There used to be UI in the settings app to control it, but the UI was
> removed, and no bugs were filed to have the underlying code changed.
> 
> In order to match the UI, I propose that we modify the code as follows:
> 
> if the settng ums.volume.VOLUMENAME.enabled exists, use that setting
> if the setting doesn't exist, use the setting for ums.volume.sdcard.enabled
> instead.

Exactly right!! As your comment, I recheck the code base v2.0 and leave comment 16. We can give fix it in Gaia. And we also can fix it in Gecko side with your suggestion. :)
Hi Dave,
now we have two ways to fix this symptom.
What do you think?
Flags: needinfo?(dhylands)
I think we should do both.
Flags: needinfo?(dhylands)
[Blocking Requested - why for this release]: It's a regression of an important and usefull feature, with 2 ways to fix it, as per earlier comments.
blocking-b2g: --- → 2.1?
[Blocking Requested - why for this release]:
Continue fixing on next release
blocking-b2g: 2.1? → 2.5?
Hi Norry,
qawanted for master/m-c. Thanks!
Flags: needinfo?(fan.luo)
Keywords: qawanted
It just occurred to me that we should probably remove the check for ums.volume.VOLUME.enabled.

If you're running a version of FxOS which has the setting in the UI, then it will create that setting.
If the setting for a volume happened to be in the disabled state, and then you perform an update to a version of FxOS which doesn't expose the setting and if the setting in the setting database stays around with it's previous disabled state, then there is no way for the user to ever turn it on.
Attached video verify_Flame_master.3gp
Hi Josh,

    According to comment 0, reproter upgraded from v2.0 to v2.1, then I try to repro this bug by upgrading from v2.2 to master, after upgraded to master, both internal storage and SD card storage are shown on PC, sharing the SD card using USB normally. (Please see video)
    Please note that there is no 'Share via USB' item on Flame v2.1&2.2&master, and the 'Share via USB' item exists only on Flame v2.0.

Hope this information helps.



Device: Flame v2.2 (Before OTA, v18D v4) 
Build ID               20150723002503

Device: Flame master (After OTA)
Build ID               20150629010206
-------------------------------------------------------------------------------
Note: 
I flash the latest Flame v2.2 user build for OTA, but after OTA, Flame master build ID is 20150629010206.
Flags: needinfo?(fan.luo)
Flags: needinfo?(jocheng)
QA Whiteboard: [MGSEI-Triage+]
Hi William,
Can you help to check whether this is caused by issue mentioned by Dave per comment 23?
Thanks
Flags: needinfo?(jocheng) → needinfo?(whsu)
(In reply to Josh Cheng [:josh] from comment #25)
> Hi William,
> Can you help to check whether this is caused by issue mentioned by Dave per
> comment 23?
> Thanks

Hi, Josh,

Sorry for the late reply.

I tried my best since I were lack of test device (Geek phone).
I used Flame-KK v2.0 to reproduce this bug. After FxOS is upgraded from v2.0 (USB storage is disabled) to v2.2, the external storage cannot be detected.

Test result proved that the bug caused by incorrect value mapping as Dave mentioned (Comment 23).

@ Build info: (OTA from v2.0 to v2.2)
  1. v2.0
    BuildID          20150722160201
    Gecko Version    32.0
  2. v2.2
    BuildID          20150729032503
    Gecko Version    37.0

@ Test Steps:
  1. FlameKK is updated to the latest v2.0 build
  2. Turn off "Share [the storage device] using USB" of external storage
  3. Change the update channel (/system/b2g/defaults/pref/updates.js) and reboot device
  4. Check new update, and then update device
  5. Enable USB storage to check whether external storage can be enabled.
Flags: needinfo?(whsu)
triage: 2.5+ as this breaks a basic feature. We should have external storage to be detected.
blocking-b2g: 2.5? → 2.5+
Ben/Eden, 

This is the storage issue, we can discuss accordingly.

Thanks,
Aaron
Hsinyi,

I'm confused with the blocking 2.5+ flag since m-c is unaffected. Are you suggesting 2.2+ instead?
Flags: needinfo?(htsai)
[Blocking Requested - why for this release]:

(In reply to Ben Tian [:btian] from comment #29)
> Hsinyi,
> 
> I'm confused with the blocking 2.5+ flag since m-c is unaffected. Are you
> suggesting 2.2+ instead?

Hi Ben,
Sorry that we seemed miss the |status-b2g-master: unaffected| fact in the triage.
Denominate 2.5 as m-c is unaffected.

Hi Josh,
You may want to decide if this needs to be fixed in 2.2. Thanks.
blocking-b2g: 2.5+ → 2.2?
Flags: needinfo?(htsai) → needinfo?(jocheng)
I think the latest symptom is not the same as original.
The latest symptom is caused by UX change.

In 2.0, we have UI to control whether to share or not for each storage. For this purpose, we have specific settings key(ums.volume.VOLUME.enabled) to control.

In current version, we can only share all storages in the same time. So we should set the settings key to true in Gaia when enabling sharing in my opinion. By doing this, the problem can be solved and the logic is still the same(share all storages -> set all the keys to true).

Hi Fred,
what do you think?
Flags: needinfo?(gasolin)
Since there is no way to set ums.volume.VOLUME.enabled, and since the VOLUME portion (especially for the external sdcard) seems to differ from phone to phone, the really simple solution seems to be to change Volume.h:

We should change:
> bool IsSharingEnabled() const       { return mCanBeShared && mSharingEnabled; }

to be:
> bool IsSharingEnabled() const       { return mCanBeShared; }

If we do this, then we should file a followup bug to remove mSharingEnabled (and IsSharingEnabked) and modify code which calls IsSharingEnabled() to call CanBeShared() instead, and remove any references to ums.volume.VOLUME.enabled in gaia and gecko.
I am fine with problem not fix in 2.2. 
NI EPM Wesley for whether the issue should fix in 2.2r.
Flags: needinfo?(jocheng) → needinfo?(whuang)
blocking-b2g: 2.2? → 2.2r?
not a regression, not a 2.2 blocker, not relevant to 2.2r new feature. So let's not block 2.2r
blocking-b2g: 2.2r? → ---
Flags: needinfo?(whuang)
Offline discussion with alphan, both alphan or dave's proposal can solve this issue. But we should focus on cases that really effect users first.
Flags: needinfo?(gasolin)
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: