Linux device node for sd card as mmcblk to access CSD register

ChrisVollo picture ChrisVollo · Oct 7, 2014 · Viewed 7.4k times · Source

I am trying to access the CSD (Card Specific Data) register on a SD card. The only way I know to do this is by having the linux system recognize it as a mmc device (Multi Media Card?) (eg. /dev/mmcblk0). Right now the device is being shown as a scsi disk (eg. /dev/sda).

Is there any way I can access the CSD Register (Card Specific Data) when is is mounted as a scsi disk?

Is there any way I can get the kernel to recognize the device as a mmc?

Thanks.

Answer

RaFD picture RaFD · Oct 7, 2014

At least some of CSD information you should get in /sys/block/diskX directory.

Example: My sd card connected to USB stick is discovered by system as /dev/sdc.

ls -l /sys/block/sdc/queue/
total 0
-rw-r--r-- 1 root root 4096 Oct  7 22:25 add_random
-r--r--r-- 1 root root 4096 Oct  7 22:25 discard_granularity
-r--r--r-- 1 root root 4096 Oct  7 22:25 discard_max_bytes
-r--r--r-- 1 root root 4096 Oct  7 22:25 discard_zeroes_data
-r--r--r-- 1 root root 4096 Oct  7 22:25 hw_sector_size
drwxr-xr-x 2 root root    0 Oct  7 22:24 iosched
-rw-r--r-- 1 root root 4096 Oct  7 22:24 iostats
-r--r--r-- 1 root root 4096 Oct  7 22:25 logical_block_size
-r--r--r-- 1 root root 4096 Oct  7 22:24 max_hw_sectors_kb
-r--r--r-- 1 root root 4096 Oct  7 22:24 max_integrity_segments
-rw-r--r-- 1 root root 4096 Oct  7 22:24 max_sectors_kb
-r--r--r-- 1 root root 4096 Oct  7 22:24 max_segment_size
-r--r--r-- 1 root root 4096 Oct  7 22:24 max_segments
-r--r--r-- 1 root root 4096 Oct  7 22:24 minimum_io_size
-rw-r--r-- 1 root root 4096 Oct  7 22:25 nomerges
-rw-r--r-- 1 root root 4096 Oct  7 22:25 nr_requests
-r--r--r-- 1 root root 4096 Oct  7 22:25 optimal_io_size
-r--r--r-- 1 root root 4096 Oct  7 22:23 physical_block_size
-rw-r--r-- 1 root root 4096 Oct  7 22:25 read_ahead_kb
-rw-r--r-- 1 root root 4096 Oct  7 22:25 rotational
-rw-r--r-- 1 root root 4096 Oct  7 22:25 rq_affinity
-rw-r--r-- 1 root root 4096 Oct  7 22:25 scheduler