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 let Android recognize USB memory stick?

Hi,

I am running Android 2.3 GingerBread on AM3517EVM, I connect a usb memory stick through usb hub, Does anybody know how to let my USB Stick be recognized in android?

BTW,

My MMC/SD can be recognized, and I know system recognize the SD card by /etc/vold.fstab, so is this similar to the usb stick?

 

Thanks,

Kevin

 

 

  • Hi satish,

    I tried the procedure on the link, but I got an interesting result.

    I just found /dev/block/sda, no sda1, my usb mass storage is of FAT32, and only one partition.

    when I plug in the usb stick, on the console, it logs like this:

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

    # usb 1-1.1: new high speed USB device using ehci-omap and address 5

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

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

    usb 1-1.1: Product: DataTraveler 2.0

    usb 1-1.1: Manufacturer: Kingston

    usb 1-1.1: SerialNumber: 200801250000000000000684

    scsi2 : usb-storage 1-1.1:1.0

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

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

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

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

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

     sda:

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

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

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

    why is it not recognized as /dev/block/sda1?

     

    Regards,

    Kevin

     


  • Hi Kevin,

    I have tried at my side and i can see /dev/block/sda1.

    It can happen that for you device node is getting created with some other name.

    Could you send us dmesg log ?

    $dmesg

     

    -

    satish

  • Hi satish,

    The log is attached here.

    1423.dmesg.txt

     

    Regards,

    Kevin

     

  • Hi Satish,

    I want to auto-mount my usb mass storage, can I implement this function by changing something in android?

    e.g., when plug in usb mass storage, it will be auto mounted to /scsi directory.

     

    Regards,

    Kevin

  • Hi Satish,

    For the problem that my android can't recognize usb mass storage as /dev/block/sda1, I find some clue about it.

    by $sudo fdisk -l, I found that, my u stick  doesn't have partition table.

     

    $sudo fdisk -l

    Disk /dev/sdc: 4022 MB, 4022337536 bytes

    124 heads, 62 sectors/track, 1021 cylinders

    Units = cylinders of 7688 * 512 = 3936256 bytes

    Sector size (logical/physical): 512 bytes / 512 bytes

    I/O size (minimum/optimal): 512 bytes / 512 bytes

    Disk identifier: 0x6f20736b

     

    This doesn't look like a partition table

    Probably you selected the wrong device.

     

       Device Boot      Start         End      Blocks   Id  System

    /dev/sdc1   ?      101215      249694   570754815+  72  Unknown

    Partition 1 has different physical/logical beginnings (non-Linux?):

         phys=(357, 116, 40) logical=(101214, 43, 11)

    Partition 1 has different physical/logical endings:

         phys=(357, 32, 45) logical=(249693, 92, 51)

    Partition 1 does not end on cylinder boundary.

    /dev/sdc2   ?       21942      273767   968014120   65  Novell Netware 386

    Partition 2 has different physical/logical beginnings (non-Linux?):

         phys=(288, 115, 43) logical=(21941, 114, 47)

    Partition 2 has different physical/logical endings:

         phys=(367, 114, 50) logical=(273766, 76, 42)

    Partition 2 does not end on cylinder boundary.

    /dev/sdc3   ?      243221      495046   968014096   79  Unknown

    Partition 3 has different physical/logical beginnings (non-Linux?):

         phys=(366, 32, 33) logical=(243220, 98, 30)

    Partition 3 has different physical/logical endings:

         phys=(357, 32, 43) logical=(495045, 59, 39)

    Partition 3 does not end on cylinder boundary.

    /dev/sdc4   ?      375349      375356       27749+   d  Unknown

    Partition 4 has different physical/logical beginnings (non-Linux?):

         phys=(372, 97, 50) logical=(375348, 92, 25)

    Partition 4 has different physical/logical endings:

         phys=(0, 10, 0) logical=(375355, 119, 33)

    Partition 4 does not end on cylinder boundary.

     

    Partition table entries are not in disk order

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

     

    I delete all partitions and reformat it in linux, then it is like this,

    Disk /dev/sdc: 4022 MB, 4022337536 bytes

    124 heads, 62 sectors/track, 1021 cylinders

    Units = cylinders of 7688 * 512 = 3936256 bytes

    Sector size (logical/physical): 512 bytes / 512 bytes

    I/O size (minimum/optimal): 512 bytes / 512 bytes

    Disk identifier: 0x6f20736b

     

       Device Boot      Start         End      Blocks   Id  System

    /dev/sdc1               1        1021     3924693    b  W95 FAT32

     

    Now, the USB mass storage can be recognized as /dev/block/sda1, So, I think partition table maybe the problem.

     

    And, do you know how to let it to be automount to a specific place? I need this function.

     

    Regards,

    Kevin

     

  • Hi Kevin,

    You can write a script for that. And lunch it from init.rc. Which will make sure after boot it will execute.

    You can refer# ( Which explained how we can auto mount USB drive)

    http://processors.wiki.ti.com/index.php/Android_Developer_FAQs#Q:How_to_write_a_script.2C_which_can_run_after_android_boot.3F

    -

    satish