Difference between revisions of "IoTGateway/BSP/Android/Gettingstarted/How to use SD/MMC Card"

From ESS-WIKI
Jump to: navigation, search
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
Starting in Android 6.0, Android supports [https://source.android.com/devices/storage/adoptable.html ''adoptable'' storage], which enables a user to set up the SD card as internal storage and store applications, their data, and media on an "adopted" SD card. Please refer to "Storage" section on the Android website [https://source.android.com/devices/storage/index.html https://source.android.com/devices/storage/index.html]
+
== Adoptable Storage ==
 
 
 
 
  
 +
There are two ways to use an SD card with the device. Android use all SD cards as '''portable storage '''before, you can remove and insert the SD card from the device or plug it into the computer or another device and transfer files, like videos, music, and photos. The Android device will continue working properly if you remove it.
  
 +
Starting in Android 6.0, Android supports [https://source.android.com/devices/storage/adoptable.html ''adoptable'' storage], which enables a user to set up the SD card as internal storage and store applications, their data, and media on an "adopted" SD card. Please refer to "Storage" section on the Android website [https://source.android.com/devices/storage/index.html https://source.android.com/devices/storage/index.html]
  
 
== Browse the SD ==
 
== Browse the SD ==
  
Android 6 Marshmallow includes a built-in file manager feature to browse the SD card.
+
Android 6 Marshmallow also includes a built-in file manager feature to browse the SD card.
  
 
*Launch the '''Settings''' app.
 
*Launch the '''Settings''' app.
Line 27: Line 27:
 
</pre>
 
</pre>
  
==== Check sysfs node ====
+
== Check sysfs node ==
 
<pre># cat /sys/block/mmcblk0/device/type
 
<pre># cat /sys/block/mmcblk0/device/type
 
MMC
 
MMC
# cat /sys/block/mmcblk1/device/type
+
# cat /sys/block/mmcblk2/device/type
 
SD
 
SD
 
</pre>
 
</pre>
  
SD Card is taken as an example:
 
  
== Generate random file ==
 
<pre># dd if=/dev/urandom of=data bs=1 count=1024
 
</pre>
 
  
Back up
+
== SD/MMC Card insertion ==
<pre># dd if=/dev/mmcblk1 of=backup bs=1 count=1024 skip=4096
+
 
</pre>
+
The kernel starts scanning once the SD card is inserted and&nbsp;create devices for each partition.&nbsp;
 +
 
 +
[[File:Sd04.JPG|RTENOTITLE]]
  
 
== Write to SD ==
 
== Write to SD ==
<pre># dd if=data of=/dev/mmcblk1 bs=1 seek=4096
+
<pre># dd if=data of=/dev/block/mmcblk2 bs=1 seek=4096
 
</pre>
 
</pre>
  
== Read and Verify ==
+
== Read from SD ==
<pre># dd if=/dev/mmcblk1 of=data1 bs=1 count=1024 skip=4096
+
<pre># dd if=/dev/block/mmcblk2 of=data1 bs=1 count=1024 skip=4096
# diff data data1
 
 
</pre>
 
</pre>
 
If fail, it shows as below:
 
<pre>Binary files data1 and data differ
 
</pre>
 
 
Restore
 
<pre># dd if=backup of=/dev/mmcblk1 bs=1 seek=4096</pre>
 

Latest revision as of 07:28, 26 January 2017

Adoptable Storage

There are two ways to use an SD card with the device. Android use all SD cards as portable storage before, you can remove and insert the SD card from the device or plug it into the computer or another device and transfer files, like videos, music, and photos. The Android device will continue working properly if you remove it.

Starting in Android 6.0, Android supports adoptable storage, which enables a user to set up the SD card as internal storage and store applications, their data, and media on an "adopted" SD card. Please refer to "Storage" section on the Android website https://source.android.com/devices/storage/index.html

Browse the SD

Android 6 Marshmallow also includes a built-in file manager feature to browse the SD card.

  • Launch the Settings app.
  • Tap on Storage & USB.
  • Tap on SD card to explore the files.

RTENOTITLE

RTENOTITLE

RTENOTITLE


External storage (SD/MMC card) is managed by a combination of the vold init service and MountService system service. Mounting of physical external storage volumes is handled by vold, which performs staging operations to prepare the media before exposing it to apps. Please refer to "Device Configuration" section on the Andrid website http://source.android.com/devices/storage/config.html

fstab.device

/devices/soc0/soc/2100000.aips-bus/219c000.usdhc/mmc_host* auto auto defaults voldmanaged=sdcard:auto,encryptable=userdata

Check sysfs node

# cat /sys/block/mmcblk0/device/type
MMC
# cat /sys/block/mmcblk2/device/type
SD


SD/MMC Card insertion

The kernel starts scanning once the SD card is inserted and create devices for each partition. 

RTENOTITLE

Write to SD

# dd if=data of=/dev/block/mmcblk2 bs=1 seek=4096

Read from SD

# dd if=/dev/block/mmcblk2 of=data1 bs=1 count=1024 skip=4096