recovery中如何挂载sdcard
recovery中手機盤使用mnt/sdcard 或者使用storage/emulated/0/這些都不行。因為手機在recovery中的掛載點跟系統(tǒng)啟動起來是不一樣的。
?
1:可以查看fstab,查看手機掛載點。
2:如果在recovery中掛載不上sdcard,可以手動掛載一下,方法如下:
?
? ?ensure_path_mounted("/sdcard");
?
int ensure_path_mounted(const char* path) {
? ? // Mount at the default mount point.
? ? return ensure_path_mounted_at(path, nullptr);
}
int ensure_path_unmounted(const char* path) {
? ? Volume* v = volume_for_path(path);
? ? if (v == NULL) {
? ? ? ? LOGE("unknown volume for path [%s]\n", path);
? ? ? ? return -1;
? ? }
? ? if (strcmp(v->fs_type, "ramdisk") == 0) {
? ? ? ? // the ramdisk is always mounted; you can't unmount it.
? ? ? ? return -1;
? ? }
? ? int result;
? ? result = scan_mounted_volumes();
? ? if (result < 0) {
? ? ? ? LOGE("failed to scan mounted volumes\n");
? ? ? ? return -1;
? ? }
? ? const MountedVolume* mv =
? ? ? ? find_mounted_volume_by_mount_point(v->mount_point);
? ? if (mv == NULL) {
? ? ? ? // volume is already unmounted
? ? ? ? return 0;
? ? }
? ? return unmount_mounted_volume(mv);
}
?
?
總結(jié)
以上是生活随笔為你收集整理的recovery中如何挂载sdcard的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 潜伏研发群一个月,我发现了程序员不为人知
- 下一篇: 用户故事与验收标准