Read CID of SDcard connected to USB-SD Reader under Linux
Asked Answered
R

1

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.

Reputable answered 22/6, 2018 at 5:13 Comment(3)
Are you asking about lsusb and lsusb -v to return that information (and detail) for all USB ID's on the system?Galle
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.Reputable
You should probably show your code.Polycotyledon
N
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.

Nelrsa answered 23/6, 2018 at 7:36 Comment(4)
Thank you. In this case, is there any way to access registers of the SDcard over USB-SD Readers ?Reputable
Unlikely. The SD registers aren't part of USBMS -- there's no standard way of accessing them over USB.Nelrsa
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 itReputable
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.)Tetradymite

© 2022 - 2024 — McMap. All rights reserved.