找到在Android上的SD卡的卷标 [英] Find SD card volume label on Android

查看:579
本文介绍了找到在Android上的SD卡的卷标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能找出插入到Android设备的SD卡的卷标?

Is it possible to find out volume label of SD card inserted into Android device?

据我了解,机器人被设计成只有一个外部存储(所返回的 Environment.getExternalStorageDirectory()),但也有相当多的设备野有内部闪存的外部存储和一个SD卡安装在该甚至狂野的组合(见的这个其他问题)。它可以通过读的/ proc /坐骑来列举这些额外的设备,但我们需要的东西,以确定他们的用户。是否有机会得到他们的卷标?

I understand that Android is designed to have just one "external storage" (as returned by Environment.getExternalStorageDirectory()), but there are quite a few devices in the wild that have internal flash as "external storage" and an SD card mounted under that or even wilder combinations (see this other question). It is possible to enumerate these additional devices by reading /proc/mounts, but we need something to identify them to the user. Is there any chance to get to their volume labels?

我检查了Linux的VFAT驱动忽略卷标的dentry和 BLKID 从UTIL-linux的读取VFAT本身。我也查了,至少对设备无我有,SD卡的块设备模式为 660 和所有者 root.root ,所以我不能这样做。所以基本上它归结到是否有可能读任何可用的工具。

I checked that Linux vfat driver ignores the volume label dentry altogether and that blkid from util-linux reads the vfat itself. I also checked that, at least on device I have, the block device of the SD card has mode 660 and owner root.root, so I can't do that. So basically it boils down to whether there is any utility that could read it available.

推荐答案

我已经找到了解决方案。

I have found a solution.

最简单的解决方案是构建busybox的,并使用它像这样: busybox的BLKID

The easiest solution is to build busybox and use it like this: busybox blkid

复杂的解决方案是找到BLKID Android和找到你需要它的源$ C ​​$ C(blkid_dev_devname功能)。

Complicated solution is to find blkid for Android and find what you need in its source code (blkid_dev_devname function).

这篇关于找到在Android上的SD卡的卷标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆