状态机:
Initializing No-Media Idle-Unmounted Pending Mounted Unmounting Checking Formatting Shared-Unmounted Shared-Mounted Unknown-Error
一、问题描述
挂U盘开机正常;开机后挂SD卡不正常。经常出现状态混乱。
二、正确流程
1.挂载
D/Vold ( 1148): Volume 1214-9D53 state changing 0 (No-Media) -> 1 (Idle-Unmounted)
D/Vold ( 1148): Volume 1214-9D53 state changing 1 (Idle-Unmounted) -> 3 (Checking)
D/Vold ( 1148): Volume 1214-9D53 state changing 3 (Checking) -> 4 (Mounted)
2.卸载
D/Vold ( 1148): Volume 1214-9D53 state changing 5 (Unmounting) -> 1 (Idle-Unmounted)
D/Vold ( 1148): Volume 1214-9D53 state changing 1 (Idle-Unmounted) -> 0 (No-Media)
3.调试
echo "add" > /sys/block/mmcblk0/uevent
进入/sys/block/mmcblk0(也可以是/sys/block下的其它目录),执行:
cat *
MAJOR=179
MINOR=0
DEVNAME=mmcblk0
DEVTYPE=disk
PHYSDEVPATH=/class/mmc_host/mmc0/mmc0:1234
PHYSDEVBUS=mmc
PHYSDEVDRIVER=mmcblk
NPARTS=1
......