How can I programatically read the SD Card's CID register, which contains a Serial Number and other information? Can I do it through Android Java, or Native code?
Active1 year, 2 months ago
Download free ethernet controller driver for xp. Thanks in advance,Eric
Android spotify wont download local files. This doesn't answer the whole question, but it does give you the card's serial number, which is relevant and useful. I came here thinking I needed the CID, and learned that what I was really looking for was the serial number, which is only a part of the CID, and is easier to obtain. So thanks for this answer. If you only need to change the card serial number (part of the CID) you can supply the old CID and the new serial number and the new CID will be calculated for you. I suggest you make a note of the old CID first, in case you want to set it back later.
Eric HamiltonEric Hamilton
11 AnswersJared Rummler
31.1k1313 gold badges100100 silver badges127127 bronze badges
Dinesh PrajapatiDinesh Prajapati
7,94855 gold badges2525 silver badges4747 bronze badges
I managed to find my SD card CID by plugging my phone to my computer via usb and using the adb tool (Android SDK)
My phone is rooted so I'm not sure if this is accessible on non-rooted phones.
Also try
These are explained in the kernel documentation http://www.mjmwired.net/kernel/Documentation/mmc/mmc-dev-attrs.txt
delcypherdelcypher
The only code I've found thus far to provide the id is C++ or C#http://jo0ls-dotnet-stuff.blogspot.com/2008/12/read-secure-digital-sd-card-serial.html Paul GregoirePaul Gregoire
http://jo0ls-dotnet-stuff.blogspot.com/2008/12/read-cid-and-csd-c-implementation.html If you are a C++ developer you may be able to take this and make it work on Android.
7,7521010 gold badges5353 silver badges120120 bronze badges
I made this one. it worked for me. hope it makes u clear!
Aditya NikhadeAditya Nikhade
As BMB wrote, you cannot know the real path of the SD card in the /sys filesystem. However, /sys implements aliases as well, and you may be able to retrieve the CID through /sys/block/mmcblk0/device/cid.
For example, on a Tattoo running 2.2, /sys/block/mmcblk0 is a soft link (established automatically by the system) to /sys/devices/platform/msm_sdcc.2/mmc_host/mmc1/mmc1:aaaa/block/mmcblk0.
Samuel TardieuSamuel Tardieu
1,91011 gold badge1313 silver badges1717 bronze badges
There is api in android for getting sd card serial id. The method is called getFatVolumeId(String mountPoint), where 'mountPoint' is sd card name (you can get this name by calling Environment.getExternalStorageDirectory()). But getFatVolumeId is kindof hidden function (or forgotten), so you want to create package in your project named android.os and the class in it to reference the native method, to be able to call it:
And the code is:
Also see the links
https://contbuleste.tistory.com/30. http://groups.google.com/group/android-framework/browse_thread/thread/1abd18435ba20a67?pli=1http://markmail.org/message/rdl4bhwywywhhiau#query:+page:1+mid:rdl4bhwywywhhiau+state:results
southertonsoutherton
There is no Android API that can do this that I am aware of and for a general solution that is needed. To provide some background the SD card is connected to a hw-controller that is specific to the device platform. It is possible to read out the cid value from the linux /sys file system if you know your platform. The following snippet works on my droid (TI omap based platform) but not on Qualcomm MSM based platforms.
On a another platform the sys file we are looking for is different. It may even differ between different cards on the same platform since I was not able to test that. On MSM based devices the path would be something like /sys/devices/platform/msm_sdcc.1/mmc_host/.
Since we have this hardware dependence on reading out the SD-card CID there would have to be an update to the Android API:s that provides general access. This API would then have to be implemented by each device manufacturer to map to the correct sd card controller driver.
BMBBMB
3,16411 gold badge1515 silver badges1616 bronze badges
I was looking for this function too but could never get a home brewed solution. I ended up finding a company that makes an SID reader. Go to nexcopy.com and look in their SD or microSD duplicator section. It can read up to 20 cards at a time.
![]()
JesusJesus
Blaupunkt cd30 keygen free. for
mmcblk0 , just write in shell as:
you can implement it in java easily.
ref:
https://www.kernel.org/doc/Documentation/mmc/mmc-dev-attrs.txt https://www.kernel.org/doc/Documentation/sysfs-rules.txt http://www.cameramemoryspeed.com/sd-memory-card-faq/reading-sd-card-cid-serial-psn-internal-numbers/
yurenchenyurenchen
Even though the relatively ancient Palm OS and Windows Mobile OS devices are able to read the SD card ID, AFAIK Android devices aren't capable of doing that yet. This is particularly troubling given the problems with the Settings.Secure.ANDROID_ID discussed here.
gregSgregS
Smart Card Serial Number
1,31544 gold badges2020 silver badges3131 bronze badges
Building on Dinesh's answer.
Dinesh suggested looking in the directory
/sys/class/mmc_host/mmc1/mmc1:*/ (where * is a number) for the file named cid , which gives us the contents of the card's CID register. This is does work in many cases, and is a very helpful start.
But
mmc1 is not always the removable SD card. Sometimes, e.g. on a Motorola Droid Pro with Android API level 10, mmc0 is the removable SD card, and mmc1 is something else. Python install pyqt4 windows. I'm guessing that mmc1 , when present, points to internal storage of some sort (possibly a non-removable microSD card). On a cheap Android tablet we tested, mmc0 is the SD card and there is no mmc1 .
So you can't just assume that
mmc1 is the SD card.
Change Sd Card Volume Serial Number
A glimmer of hope: It seems (so far) that by looking at the
type file in the same directory as the cid file (e.g. /sys/class/mmc_host/mmc1/mmc1:0007/type ), we can determine which is which: a type value of SD indicates a removable SD card, while MMC Download security spy for mac. is not.
However, that's just from testing on a few Android devices. I can't find any specifications about the contents of the
type file, so if somebody else knows of relevant documentation, please let me know.
Modify Sd Card Serial Number
Of course, MMC and SD are just two different storage technology standards, and SD is backward-compatible with MMC. So it's not necessarily the case that type SD always corresponds to an external microSD card. It doesn't seem likely that
MMC could indicate a microSD card at all (if the type field is populated accurately); but on the other hand, it's conceivable that a non-removable SD card could have type SD . Spotify add to queue app.
For further research: Does this approach work when an microSD card is connected via a USB adapter? My one test on this, with a tablet, had the USB-connected microSD card show up as LarsH
mmc1 , with type SD .
Sd Card Number MeaningLarsHSd Card Serial Number
21.7k55 gold badges6363 silver badges124124 bronze badges
![]() Not the answer you're looking for? Browse other questions tagged androidc++windowsmfc or ask your own question.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |