Friday, August 17, 2007

Fetching Unique ID of SD Card

You can call ExpCardInfo for the ID, but somehow the results differ:
m505: SD016_00016437230807,

T-T : SD016_000164372300D1
and even worse on a Handera 330:H330: SD016_00016437
The last 3 chars of m505 and T-T could be some kind of Checksum but whatabout the H330? This leads to the question:
How much of the numbers are significant? How much of these is the realCard-ID and whats irrelevant?


////////////////////////////////////////////////////////////////////////////////////////////

The last 4 digits of the card ID contains the date the card wasmanufactured. On the Tungsten T, there was some sort of byte ordering problem with this DWord, That explains why "0807" != "00D1" in your data above. Palm stated they will fix this problem on future devices, so that M- and T-class devices shall report the same number. This glitchrenders the last 4 digits insignificant.
The significant digits, then, are the last 8 hex chars after the *last* underscore are the card's serial number (exception: the last 2 charswill be 0x00 for old MMC cards). This serial number is required to be unique for a particular product line of cards, however this is not aglobal unique ID across all SD/MMC card vendors, or even across multiple models (product lines) of the same vendor. In other words, SanDisk could make a 512 Meg card with s/n 00000000, and then make a 1 GB cardwith the same s/n. To create a global unique ID that takes models & manufactures into account, one could hash the data before the *last* underscore, which is the card's manufacture and model number, and thenconcatenate it with the serial number.
I emphasize 'last' underscore above, because the manufacture's text ID(the first 5 bytes) could also contain an underscore.
So in your example above, "00016437" is the unique serial number of theSD card, the characters after this should be ignored, and "SD016" can beused to differentiate the model (product line).

No comments: