Linux application decodes mmc ext csd

Currently, from an application with user space with su access, I am parsing ext_csd from the debugfs file system, converting the string to raw byte data and passing it to the ext_csd function for decoding to populate the structure that I wrote myself.

I am wondering if there is a more efficient way to do this, or is less error prone? For example, there is mmc_read_ext_csd () and mmc_decode_ext_csd () in the kernel path drivers /mmc/core/mmc.c

Is there a way to use this driver function from a user application? Or the ioctl team? I can not find any API documentation for ioctl commands for mmcblk0, only in the kernel source code /block/ioctl.c

Is there a way to see if an emmc card is a large capacity from a user application?

+4
source share
1 answer

mmc-utils can issue ext_csd via ioctl and output processed texts. http://git.kernel.org/cgit/linux/kernel/git/cjb/mmc-utils.git/

There are those that can parse hexadecimal strings obtained from debugfs. It's hard to say if it is more reliable than your own code. https://github.com/haoxingz/emmc5_register_reader

I am not sure about detecting high capacity.

+2
source

Source: https://habr.com/ru/post/1585059/


All Articles