Android SD card, USB flash drive automatically mounted

Source: Internet
Author: User

 

The SD card cannot be automatically mounted during the migration of Android to the platform. Check the related information. In android2.3, the vold program is responsible for checking the sysfs File System of the kernel. After the SD card is inserted, it is automatically mounted. There is a vold under the file system directory/system/etc. fstab file, which is an interactive interface between the system and the user's hardware platform. you can configure this file based on your own platform. The content in the file is relatively simple, you only need to specify the folder path to be queried by the vold program under SYS. After the SD card is inserted into the device, the corresponding file will be generated in this path, and the vold can check.

 

The content of my vold. fstab file is as follows:

 

# Vold 2.0 fstab for ok6410
##

#######################
# Regular device Mount
##
# Format: dev_mount <label> <mount_point> <part> <sysfs_path1...>
# Label-label for the volume
# Mount_point-where the volume will be mounted
# Part-partition #(1 based), or 'auto' for first usable partition.
# <Sysfs_path>-List of sysfs paths to source Devices
######################

# Mounts the first usable partition of the specified device

Dev_mount sdcard/mnt/sdcard Auto/devices/platform/goldfish_mmc.0/devices/platform/s3c-sdhci.0/mmc_host/mmc0

The above are comments and help. The most important thing is the last sentence. Auto indicates the first partition of the mounted SD card, followed by the vold monitoring path. When SD is inserted, /devices/platform/s3c-sdhci.0/mmc_host/mmc0 path will have an extra folder, please confirm your hardware platform corresponding path.

 

In addition to configuring this file, you need to pay attention to the following points:

 

1

If you insert the SD card to the Development Board and add several more device nodes under the/dev/block/directory to prove that the SD card driver is successfully loaded, mmcblk0 and mmcblk0p1 nodes will be formed under my directory, note: mmcblk0 indicates the first SD card device, and mmcblk0p1 indicates the first partition of the first SD card device. You cannot mount/dev/block/mmcblk0 to the file system. Instead, you can mount the partition of the SD card to the file system, as shown below:

 

 

# Mount-T vfat/dev/block/mmcblk0/sdcard/

<3> fat: utf8 is not a recommended Io charset for fat filesystems, filesystem wil
L be case sensitive!
Fat: utf8 is not a recommended Io charset for fat filesystems, filesystem will B
E case sensitive!
<7> mmc0: Starting limit 17 Arg 00000000 flags limit 00b5
<7> mmc0: blksz 512 Blocks 1 flags 00000200 tsac 100 ms nsac 0
<7> sdhci [sdhci_irq ()]: *** mmc0 got interrupt: 0x00000001
<7> sdhci [sdhci_irq ()]: *** mmc0 got interrupt: 0x00000002
<7> mmc0: req done (cost 17): 0: 00000900 00000000 00000000
<7> mmc0: 512 bytes transferred: 0
Mount: invalid argument

 

If you mount mmcblk0, this error message is displayed, and mmcblk0p1 is successfully mounted. Of course, you should not manually mount it under Android. Otherwise, the SD card cannot be found in the upper-layer application software,

 

2

 

In the android Kernel configuration (Linux Kernel configuration), note:General setup-> enable deprecated sysfs features to support old userspace tools canceledOtherwise, the SD card of vold detection may be affected.

 

This item has a certain impact on the user space software, if this item is selected, the/devices/platform/s3c-sdhci.0/mmc_host: mmc0/mmc0 directory will be generated in the SYS directory, instead of the path/devices/platform/s3c-sdhci.0/mmc_host/mmc0 we need, not selecting this option is sysfs file system's support for old user space programs.

 

 

After the vold is mounted to SD, you can check it in the android application. You can view the image files on the SD card by using the browser program.

U disk mount the same way, U disk inserted into the Development Board USB interface, in the/sys/devices/platform/s3c2410-ohci/usb1 under one more folder appears, you only need to add this path to the monitoring path list, my last vold. fstab is as follows:

 

Dev_mount sdcard/mnt/sdcard Auto/devices/platform/s3c2410-ohci/usb1/devices/platform/s3c-sdhci.0/mmc_host/mmc0

Note: Each parameter must be separated by a tab key. Otherwise, the vold program cannot correctly read the parameter.

 

In this way, when the USB flash drive is inserted, the android interface program will recognize it and prompt the SD card to be inserted (Why do not prompt the USB flash drive? If you are interested, you can study it yourself). You can use the image browser, enable the file in the USB flash drive for the audio player. I have tried to mount the USB flash drive to the/mnt/udisk directory. You can modify the volume. the fstab file is easy to implement. It is displayed in the command environment that has been mounted successfully. However, the android image browser and audio playback software (which comes with Android) cannot detect the USB flash drive, therefore, mount the USB flash disk to the/mnt/sdcard directory so that the upper-layer program can recognize the USB flash disk.

 

You can modify the vold software to check the/mnt/udisk directory, modify the interface prompt, and prompt to find the "U disk", which is relatively more formal, no need to bring the SD card hat to the USB flash drive.

 

The above are some of the issues that I encountered during the migration of Android and USB flash drives. I hope it will be helpful to some netizens, in addition, I will also record other problems encountered during the migration from android2.3 to cloud6410. Please wait .....

 


 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.