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.

auto mount OTG USB mass storage device in android on DM3730

Other Parts Discussed in Thread: DM3730

Hello,

I have enabled OTG on a customized board based on DM3730 evm. The OTG seems working fine. When I plug in USB cable, adb is enabled. When I unplugged USB cable, adbd is stopped. The USB mass storage device is also detected by linux kernel when I plug it in.

I can see the following message:

[  194.196594] hub 2-0:1.0: port 1, status 0101, change 0001, 12 Mb/s
[  194.480957] usb 2-1: new high speed USB device using musb-hdrc and address 5
[  194.642089] usb 2-1: device v0930 p6545 is not supported
[  194.647674] usb 2-1: New USB device found, idVendor=0930, idProduct=6545
[  194.654663] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  194.662139] usb 2-1: Product: DT 101 G2
[  194.666137] usb 2-1: Manufacturer: Kingston
[  194.670501] usb 2-1: SerialNumber: 001372995DDDEB50B5180011
[  194.686737] scsi3 : usb-storage 2-1:1.0
[  194.696319] hub 2-0:1.0: port 1 enable change, status 00000503
[  195.784362] scsi 3:0:0:0: Direct-Access     Kingston DT 101 G2        PMAP PQ: 0 ANSI: 0 CCS
[  196.356201] sd 3:0:0:0: [sda] 7669824 512-byte logical blocks: (3.92 GB/3.65 GiB)
[  196.364929] sd 3:0:0:0: [sda] Write Protect is off
[  196.369934] sd 3:0:0:0: [sda] Assuming drive cache: write through
[  196.382598] sd 3:0:0:0: [sda] Assuming drive cache: write through
[  196.405212]  sda: sda1
[  196.412719] sd 3:0:0:0: [sda] Assuming drive cache: write through
[  196.419128] sd 3:0:0:0: [sda] Attached SCSI removable disk

I can also manually mount it.

However I have some difficulties in auto-mounting it in Android.

Here is what I did: (following ICS porting guide)

1. In vold.fstab, add:

dev_mount usb /mnt/usb2 auto /devices/platform/musb-omap2430.0/musb-hdrc.0/usb2

2. init.rc is updated as follows
# create mountpoints
    mkdir /mnt 0775 root system
    mkdir /mnt/sdcard 0000 system system
    mkdir /mnt/usb2 0000 system system

... 
# Backwards Compat - XXX: Going away in G*
    symlink /mnt/sdcard /sdcard
    symlink /mnt/usb2 /usb2

    mkdir /system
    mkdir /data 0771 system system
3. Entry is added to the storage list: overlay/frameworks/base/core/res/res/xml/storage_list.xml 
 <storage android:mountPoint="/mnt/usb2"
             android:storageDescription="@string/storage_usb"
             android:removable="true" />
However, the USB mass storage device cannot be auto-mounted.

I can see /sys/devices/platform/musb-omap2430.0/musb-hdrc.0/usb2/2-1/2-1:1.0 folder is getting created
when the USB device is plugged in and getting deleted when it is unplugged. I also used "/sys/devices/platform/musb-omap2430.0/musb-hdrc.0/usb2/2-1/2-1:1.0"
in the vold.fstab but the problem remains.

Does anyone know how to fix this problem?

Thanks,
James