After I changed internal SD card to emulated (previous was on it's own partition) I cannot enable USB mass storage of internal card. I got inspired by section "Emulated primary only (like Nexus 4)" in https://source.android.com/devices/storage/config-example.html.

I'm trying to figure out what to change in vold.fstab to be able to enable USB mass storage.

I'm working on Allwinner A31s, on Android 4.2.2 Jelly Bean.

vold.fstab before my changes was (internal card was /mnt/sdcard):

dev_mount   sdcard  /mnt/sdcard auto    /devices/virtual/block/nandk
dev_mount   extsd   /mnt/extsd  auto    /devices/platform/sunxi-mmc.1/mmc_host  /devices/platform/sunxi-mmc.0/mmc_host
dev_mount   usbhost1    /mnt/usbhost1   auto    /devices/platform/sw-ehci.1 /devices/platform/sw_hcd_host0  /devices/platform/sw-ehci.2 /devices/platform/sw-ohci.1 /devices/platform/sw-ohci.2

I removed the first line (for /mnt/sdcard). I also tried to add line:

dev_mount   sdcard  /mnt/shell/emulated     auto    /devices/platform/sw-ehci.1 /devices/platform/sw_hcd_host0  /devices/platform/sw-ehci.2 /devices/platform/sw-ohci.1 /devices/platform/sw-ohci.2

but it didn't help. I suppose it needs to be entry in vold.fstab for emulated devices as well. How to find correct sysfs_path?

I also changed attribute android:emulated to true in storage_list.xml.

UPDATE: The change in partition layout was to remove partition for internal SD card (/mnt/sdcard) and resize /data partition – add this free space to it. Internal SD card is mounted into /data partition (as /mnt/shell/emulated in /data/media).

It's done with sdcard service (defined in rc script):

service sdcard /system/bin/sdcard /data/media /mnt/shell/emulated 1023 1023
    class late_start

I have probably some misconfiguration in storage_list.xml as UsbStorageActivity is shown, but after clicking to enable button does not finish enabling. But this is a minor problem, the main issue is the inability to set UMS.

When I watch vold with vdc monitor it does nothing, prior to previous version when it worked as expected - unmounting device and changing it's state). This happens also if there is also external SD card presented.

Debugging with logcat shows that in case of emulated SD card:

  • PackageManager is not called
  • Vold is not called
  • MediaScannerReceiver is not called
  • MountService (runned in thread by UsbStorageActivity) skips both internal and partition (doesn't umount either of them) and progress indicator keeps running.
  • 2
    You can't. UMS only works on complete partitions, which are "physically handed-out". So if I understood your question correctly, and your "emulated card" now is just "a subdirectory of some other storage" (and no longer a separate partition – your question is lacking those details), AFAIK there's no way to use it with UMS. – Izzy May 18 '15 at 15:55
  • @izzy: Thanks for info. Could you provide link to documentation? Is it version dependent, or is it valid for all android versions (>= Jelly Bean)? What surprises me is that Nexus 4 (mako) should have internal card emulated (not on physical device) and it's possible to share it to computer (as MTP or PTP) &ndash; see <a href="github.com/CyanogenMod/android_device_lge_mako/blob/cm-10.1/… for Jelly Bean</a>. The main purpose is to connect internal storage anyhow to computer. – pevik May 19 '15 at 7:27
  • All depends on setup. The "emulated" variant is using FUSE. You can of course set this on top of a "full partition" (which might be the case with the N4), and then of course can make that available via UMS as well. Doesn't depend on Android version, but rather on whether the underlying "card" is on a separate partition or not. But no, I have no link to documentation – just "general knowledge" :) – Izzy May 19 '15 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.