6

I can read CID info easily when the card is connected to SDIO interface:

stulluk@debian:~$ cat /sys/bus/mmc/devices/mmc0\:0007/cid
0150414a4836344713da8544b3012300
stulluk@debian:~$

But when I connect same card to USB-SDCard reader, I couldn't find any interface to read it in sysfs.

Is there such interface in Linux? Or, is there any other way to read from registers of SDcard over USB in Userspace, without modifying Linux Kernel ?

Many thanks.

3
  • Are you asking about lsusb and lsusb -v to return that information (and detail) for all USB ID's on the system? Commented Jun 22, 2018 at 6:14
  • 1
    No I am not asking that. CID is a 16byte long number stored in registers of SDcards. I am asking, if there is a way to read registers of SDcards which are connected to USB-SD Converters. Commented Jun 22, 2018 at 11:02
  • You should probably show your code.
    – jww
    Commented Jun 23, 2018 at 6:22

1 Answer 1

7

But when I connect same card to USB-SDCard reader, I couldn't find any interface to read it in sysfs.

That would be because it's not available.

USB SD card readers use the USB Mass Storage device class. This interface is media-agnostic -- it's essentially a simplified version of SCSI. It doesn't provide any standard way of accessing SD-specific information, like the CID register, and most SD readers don't implement anything of the sort.

4
  • Thank you. In this case, is there any way to access registers of the SDcard over USB-SD Readers ? Commented Jun 24, 2018 at 7:57
  • 1
    Unlikely. The SD registers aren't part of USBMS -- there's no standard way of accessing them over USB.
    – user149341
    Commented Jun 24, 2018 at 20:17
  • 3
    After many years, this is the right answer. SD card readers has a chip inside. That chip is kind of a bridge, where one side is a USB device ( connected to your PC via USB cable ) and the other side is SDcard interface ( Where you insert your uSDcard into slot ). Most SD cardreaders in the market doesn't provide any standard or non-standard way of accessing registers of Sdcard Controllers. Some manufacturers ( cough GenesysLogic cough ) can provide some proprietary way of accessing this data , or some SDcard manufacturers ( cough swissbit cough ) provide a proprietary tool ( SBLTM) for it Commented Dec 27, 2021 at 19:12
  • I found a Windows solution which doing something at here github.com/DTL2020/SDcard (you can read more about it at the site superuser.com/questions/1627622/… ) It can be working in Linux somehow? (I tested with an USB card reader with RTS5329 chipset and under windows I got some 16 chars results from my SD card, but it is not the CID. (I'm not installed the driver I opened the sdcard.exe with the right parameters only.)
    – William
    Commented Jan 27 at 15:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.