How to read the SD Card ID number?

后端 未结 12 2203
[愿得一人]
[愿得一人] 2020-12-05 08:15

How can I programatically read the SD Card\'s CID register, which contains a Serial Number and other information? Can I do it through Android Java, or Native code?

12条回答
  •  独厮守ぢ
    2020-12-05 08:56

    I managed to find my SD card CID by plugging my phone to my computer via usb and using the adb tool (Android SDK)

    $ adb shell
    # cat /sys/block/mmcblk0/../../cid
    

    My phone is rooted so I'm not sure if this is accessible on non-rooted phones.

    Also try

    $ adb shell
    # cd /sys/block/mmcblk0/../../
    # ls
    block                 fwrev                 preferred_erase_size
    cid                   hwrev                 scr
    csd                   manfid                serial
    date                  name                  subsystem
    driver                oemid                 type
    erase_size            power                 uevent
    

    These are explained in the kernel documentation http://www.mjmwired.net/kernel/Documentation/mmc/mmc-dev-attrs.txt

提交回复
热议问题