This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to auto mount USB mass storage in Android2.3?

Hi,

In Android 2.3, vold is responsible for auto mount medias, such as MMC/SD.

I want to auto mount USB mass storage to /mnt/udisk, so I changed /etc/vold.fstab,

dev_mount sdcard /mnt/sdcard 1 /devices/platform/mmci-omap-hs.0/mmc_host/mmc0

dev_mount udisk /mnt/udisk auto /devices/platform/ehci-omap.0/usb1

 

However, it doesn't not work, and logcat logs as this:

01-01 04:45:10.554: INFO/Vold(822): Vold 2.1 (the revenge) firing up

01-01 04:45:10.585: DEBUG/Vold(822): USB mass storage support is not enabled in the kernel

01-01 04:45:10.585: DEBUG/Vold(822): usb_configuration switch is not enabled in the kernel

01-01 04:45:10.601: DEBUG/Vold(822): Volume sdcard state changing -1 (Initializing) -> 0 (No-Media)

01-01 04:45:10.601: DEBUG/Vold(822): Volume udisk state changing -1 (Initializing) -> 0 (No-Media)

01-01 04:45:15.195: DEBUG/Vold(822): Volume udisk state changing 0 (No-Media) -> 2 (Pending)

01-01 04:45:15.195: DEBUG/Vold(822): Volume udisk state changing 2 (Pending) -> 1 (Idle-Unmounted)

and dmesg is as following,

usb 1-1.3: New USB device found, idVendor=0951, idProduct=1603

usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3

usb 1-1.3: Product: DataTraveler 2.0

usb 1-1.3: Manufacturer: Kingston

usb 1-1.3: SerialNumber: 200801250000000000000684

scsi0 : usb-storage 1-1.3:1.0

scsi 0:0:0:0: Direct-Access     Kingston DataTraveler 2.0 1.00 PQ: 0 ANSI: 2

sd 0:0:0:0: [sda] 7856128 512-byte logical blocks: (4.02 GB/3.74 GiB)

sd 0:0:0:0: [sda] Write Protect is off

sd 0:0:0:0: [sda] Assuming drive cache: write through

sd 0:0:0:0: [sda] Assuming drive cache: write through

 sda: sda1

sd 0:0:0:0: [sda] Assuming drive cache: write through

sd 0:0:0:0: [sda] Attached SCSI removable disk

 

Does anybody know what is wrong with my procedure? Or any suggestions?

 

Thanks,

Kevin

 

  • Kevin,

    As per the following errors from logcat dump.

    01-01 04:45:10.585: DEBUG/Vold(822): USB mass storage support is not enabled in the kernel
    01-01 04:45:10.585: DEBUG/Vold(822): usb_configuration switch is not enabled in the kernel

    It seems that Android Mass Storage and Switch class support is not enabled in your kernel.

    Enable Android gadget mass storage function (USB_ANDROID_MASS_STORAGE) at:
    -> Device Drivers
           -> USB support
             -> USB Gadget Support
               -> USB Gadget Drivers
                 -> Android Gadget
                 -> Android gadget mass storage function

    Enable Switch Class support (CONFIG_SWITCH) at:
    -> Device Drivers
           -> Switch class support

    Regards,
    Amit Pundir

  • Hi Amit Pundir,

    I enabled options as you told me, but the results are the same as before.

    My DevKit: TI-Android-GingerBread-2.3-DevKit-1.0

    Kernel: 2.6.32

     

    I am sure they are enabled, and I also checked it in my .config file.

    CONFIG_USB_ANDROID_MASS_STORAGE=y

    CONFIG_SWITCH=y

    Should TI-android-GingerBread-2.3 Vold not support usb mass storage correctly? Need we change sources of Vold?

     

    Thanks,

    Kevin

     

  • Kevin,

    You don't need to change anything in Vold sources. USB mount should have worked straight away if you have put correct entry in vold.fstab

    I just ran through your previous mail and found that your entries in vold.fstab are not correct.

    First of all only one of the storage device either MMC or USB will be mounted as external storage because Android supports only one external storage medium which it will scan for media content. So you need to remove MMC entry if you want to use USB device as the default storage device and vice-versa.

    Secondly, your USB device SYSFS entry in vold.fstab is not correct as well. It should be something like following:

    dev_mount sdcard /mnt/sdcard auto /devices/platform/ehci-omap.0/usb1/1-x/1-x:x.0/host0

    where x,y are the USB port/sub-ports to which USB storage medium is connected.

    If you intend to use both MMC and USB then you can mount any one of them as default storage medium and browse through the another using any of the available file manager applications. Check this link for more details http://groups.google.com/group/android-porting/msg/bd03acbe5ddfa2ae

    Regards,
    Amit Pundir

  • Hi Amit Pundir,

    Currently, my USB mass storage can be recognized and auto mounted, I did nothing more, but it is good now, I don't know why. my /etc/vold.fstab is still the same as before.

    If the usb storage isn't auto mounted successfully, then I unplug it and plug it again, it will be auto mounted.

    I list logcat as below,

    ---------------------------------------------------------------

    01-01 00:09:17.593: INFO/Vold(814): Vold 2.1 (the revenge) firing up

    01-01 00:09:17.617: DEBUG/Vold(814): USB mass storage support is not enabled in the kernel

    01-01 00:09:17.617: DEBUG/Vold(814): usb_configuration switch is not enabled in the kernel

    01-01 00:09:17.656: DEBUG/Vold(814): Volume sdcard state changing -1 (Initializing) -> 0 (No-Media)

    01-01 00:09:17.656: DEBUG/Vold(814): Volume udisk state changing -1 (Initializing) -> 0 (No-Media)

    01-01 00:10:20.382: DEBUG/Vold(814): Volume udisk state changing 0 (No-Media) -> 2 (Pending)

    01-01 00:10:20.382: DEBUG/Vold(814): Volume udisk state changing 2 (Pending) -> 1 (Idle-Unmounted)

    01-01 00:10:20.414: INFO/Vold(814): /dev/block/vold/8:1 being considered for volume udisk

    01-01 00:10:20.414: DEBUG/Vold(814): Volume udisk state changing 1 (Idle-Unmounted) -> 3 (Checking)

    01-01 00:10:21.851: INFO/Vold(814): Filesystem check completed OK

    01-01 00:10:21.859: INFO/Vold(814): Device /dev/block/vold/8:1, target /mnt/udisk mounted @ /mnt/secure/staging

    01-01 00:10:21.867: DEBUG/Vold(814): Volume udisk state changing 3 (Checking) -> 4 (Mounted)

    01-01 00:10:43.007: DEBUG/Vold(814): Volume udisk state changing 4 (Mounted) -> 5 (Unmounting)

    01-01 00:10:44.039: INFO/Vold(814): /mnt/secure/staging/.android_secure sucessfully unmounted

    01-01 00:10:44.039: INFO/Vold(814): /mnt/secure/asec sucessfully unmounted

    01-01 00:10:44.039: WARN/Vold(814): Failed to unmount /mnt/secure/staging (Device or resource busy, retries 9, action 0)

    01-01 00:10:45.148: WARN/Vold(814): Failed to unmount /mnt/secure/staging (Device or resource busy, retries 8, action 0)

    01-01 00:10:46.242: WARN/Vold(814): Failed to unmount /mnt/secure/staging (Device or resource busy, retries 7, action 0)

    01-01 00:10:47.429: WARN/Vold(814): Failed to unmount /mnt/secure/staging (Device or resource busy, retries 6, action 0)

    01-01 00:10:48.617: WARN/Vold(814): Failed to unmount /mnt/secure/staging (Device or resource busy, retries 5, action 0)

    01-01 00:10:49.718: WARN/Vold(814): Failed to unmount /mnt/secure/staging (Device or resource busy, retries 4, action 0)

    01-01 00:10:50.812: WARN/Vold(814): Failed to unmount /mnt/secure/staging (Device or resource busy, retries 3, action 0)

    01-01 00:10:51.914: WARN/Vold(814): Failed to unmount /mnt/secure/staging (Device or resource busy, retries 2, action 1)

    01-01 00:10:53.078: WARN/Vold(814): Failed to unmount /mnt/secure/staging (Device or resource busy, retries 1, action 2)

    01-01 00:10:54.351: INFO/Vold(814): /mnt/secure/staging sucessfully unmounted

    01-01 00:10:54.351: INFO/Vold(814): /mnt/udisk unmounted sucessfully

    01-01 00:10:54.351: DEBUG/Vold(814): Volume udisk state changing 5 (Unmounting) -> 1 (Idle-Unmounted)

    01-01 00:10:54.351: DEBUG/Vold(814): Volume udisk state changing 1 (Idle-Unmounted) -> 0 (No-Media)

    01-01 00:11:46.656: DEBUG/Vold(814): Volume udisk state changing 0 (No-Media) -> 2 (Pending)

    01-01 00:11:46.664: DEBUG/Vold(814): Volume udisk state changing 2 (Pending) -> 1 (Idle-Unmounted)

    01-01 00:11:46.679: INFO/Vold(814): /dev/block/vold/8:1 being considered for volume udisk

    01-01 00:11:46.679: DEBUG/Vold(814): Volume udisk state changing 1 (Idle-Unmounted) -> 3 (Checking)

    01-01 00:11:48.156: INFO/Vold(814): Filesystem check completed OK

    01-01 00:11:48.164: INFO/Vold(814): Device /dev/block/vold/8:1, target /mnt/udisk mounted @ /mnt/secure/staging

    01-01 00:11:48.164: DEBUG/Vold(814): Volume udisk state changing 3 (Checking) -> 4 (Mounted)

    -----------------------------------------------------------------------------------------------

    And there is no host0 in my system,

    # pwd

    /sys/devices/platform/ehci-omap.0/usb1/1-1/1-1:1.0

    # ls host0

    host0: No such file or directory

     

    Whatever, it works now.

     

    Thanks,

    Kevin

  • Kevin Chow said:

    CONFIG_USB_ANDROID_MASS_STORAGE=y

     

    This config option is meant for use with USB gadget feature.  i.e. your device/evm shows up as a USB mass storage when you connect it to a desktop PC. It is not related to mounting any externally connected USB Mass Storage devices.

  • Ohh.. Yes. Correct.

    My Bad.

    Regards,
    Amit Pundir

  • Hi Kevin,

    One of our community member got this working. Please refer to below thread for auto mounting usb mass storage.

    http://e2e.ti.com/support/embedded/f/509/p/119138/438264.aspx#438264

    Thanks and Regards,

    Pankaj Bharadiya