This is a discussion on Serial Number from Compact Flash Cards - Linux ; X-No-Archive: yes Hi, I am trying to read the serial ID from SanDisk Compact Flash cards in a Linux system. When using one of these cards inside a mini computer (which is using the CF cards as HD replacement and ...
I am trying to read the serial ID from SanDisk Compact Flash cards in
a Linux system. When using one of these cards inside a mini computer
(which is using the CF cards as HD replacement and mounts them/treats
them as IDE devices), it is trivial to request the serial (in C) with
ioctl (fd, HDIO_GET_IDENTITY, &diskid);
memcpy (id, diskid.serial_no, 20);
which works great. But when addressing a CF card as mass storage
device (e. g. by a USB multi-card reader), I did not yet figure out
how to request the ID. Neither hdparm/sdparm nor other tools were
able to determine the ID of the CF card, nor did I find a system API
(or similar) to request it.
I was able to get the ID from a 512MB USB stick w/o a problem (by USB
API calls). But w/ the multi-card reader, I just get the serial ID
from the card reader (which is then 000001), not from the card plugged
into one of the interfaces (e. g. /dev/sdb).
CF+ and CompactFlash Spec Rev 4.1 defines with IDE protocol the
possibility to gain the information per identify device IDE command
and return of device serial number in word address 10-19. But I did
not figure out how to map IDE commands over SG for mass storage
devices assigned in a slot of a reader unit like multi-reader device.
Does anybody has a glue, if there is a way to determine the serial ID
from a CF card over USB/mass storage device API, kernel API or a tool,
which is able to do that? Or maybe there is a way to address IDE
commands to a mass storage device connected with USB? Or something
Thanks & BR,