What I have: I know the place in the filesystem where a microSD card is mounted, e.g.
What I need: To find out which device folder it corresponds to, e.g.
/sys/class/mmc_host/mmc0 (which is a link to
/sys/class/mmc_host/mmc1 (which is a link to
I need to find the right directory so that I can grab the contents of files under it, such as
oemid, and so on.
I could take a guess that
/sys/class/mmc_host/mmc1 corresponds to the microSD card mounted at
/storage/sdcard1, but on some Android devices it's
Since we're on Android, we have some limitations relative to more typical Linux:
dmesgdoesn't run (klogctl: operation not permitted)
dfdoesn't output the "mounted on" column
- no access to
stat()or other low-level calls; at least not without some NDK development, which is a deep swimming pool to dive into, requiring architecture-specific builds
Here's the output of
df related to the microSD card:
Filesystem Size Used Free Blksize /storage/sdcard1 29.0G 2.0G 27.0G 32768
(which is confusing because I thought, and
mount indicates, that
/storage/sdcard is the mount point rather than the filesystem).
And the relevant output of
/dev/block/vold/179:65 /mnt/media_rw/sdcard1 vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1023,gid=1023,fmask=0007,dmask=0007,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0 /dev/fuse /storage/sdcard1 fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
The above shows that the filesystem mounted at
/dev/fuse is mounted in three places:
$ mount | grep fuse /dev/fuse /mnt/shell/emulated fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0 /dev/fuse /storage/emulated/legacy fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0 /dev/fuse /storage/sdcard1 fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
and in any case I still don't see any way to figure out which
/sys/devices/... directory corresponds to
So, one way to answer the initial question would probably be to answer the sub-question, How can I find out the /sys/class or /sys/devices entry for a FUSE-mounted filesystem? That should answer the question for this case at least (but I don't know if all Android devices mount microSD cards in the same way).
Any suggestions are appreciated.