LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   Internal SD Card Information (https://www.linuxquestions.org/questions/debian-26/internal-sd-card-information-4175632218/)

davidriver2000 06-19-2018 06:23 AM

Internal SD Card Information
 
hi all
I want this information : Internal SD Card Information
But I do not know what kind of Linux distributions I should use to do this ( for run this code /sys/block/mmcblk0/device/ )
Please test it first and then introduce what you have done.
It's really hard to learn and work with Linux


guide :

Internal SD Card Information

Information about an SD card is encoded in its internal card registries. One of these is the Card Identification (CID) Register, a 16 byte code that contains information that uniquely identifies the SD card, including the card serial number (PSN), manufacturer ID number (MID) and manufacture date (MDT). The CID register is set when the card is manufactured and cannot be changed after it is set. (According to SD card specification the information is only to be written once, however if a card does not conform to the specification this information could be changed!)
How to read the CID from an SD card

One way to read the CID is to use a laptop with an SD card slot. Card readers in laptops are usually connected directly through the PCI bus (or IDE bus). This will not work through a USB card reader because the command to retrieve the card information is intercepted and not understood by card readers. Not all computers with built-in card slots will work, some internal card readers are connected through a USB bus.

Assuming you have the proper hardware, there are several methods you can use to get the card information. With Linux, reading the internal SD card information is simple. Insert the card and look under /sys/block/mmcblk0/device/ (this location may change depending on your platform, it may be mmcblk1 or in a different location). Under this location you will see several attributes available that include the CID and CSD registers and the information inside it.

To view the CID, the command is cat /sys/block/mmcblk0/device/cid (the exact location may be different)
What information is in the CID?

The following information is stored in the CID:
Name Field Linux attribute* Description
Manufacturer ID MID manfid Assigned by SD-3C, LLC.
OEM/Application ID OID oemid Identifies the card OEM and/or the card contents. Assigned by SD-3C, LLC.
Product Name PNM name 5 characters long (ASCII)
Product Revision PRV hwrev, fwrev Two binary coded decimal (BCD) digits. Each is four bits. The PRV is in the form x.y. The PRV can also be found by using the hwrev and fwrev, where x=hwrev and y=fwrev
Serial Number PSN serial This 32 bit field is intended to be read as an unsigned integer
Manufacture Date Code MDT date Manufacture date is stored in the form yym (offset from 2000)
CRC7 checksum CRC 7 bit code used for checking errors in the card register

* these are the attribute titles used for the card in Linux

For more information, refer to the SD Association Simplified Specifications.
How can I use the information from the CID?

The CID information can be helpful in identifying counterfeit memory cards. We include the CID data in our SD card reviews so you may compare it with your cards.

https://www.cameramemoryspeed.com/sd...ernal-numbers/

business_kid 06-19-2018 08:01 AM

Linux is actually Gnu/Linux, and things like this have been working on computers since the earliest days.

It's a learning curve. Have you run lspci or lsusb?

davidriver2000 06-19-2018 01:24 PM

I have not implemented any command in Linux yet
The only command that told me is the following command
/sys/block/mmcblk0/device/
Which I did at Kali terminal but did not have any result
But according to the site's claims, these commands mentioned above are running on Linux, but I can not run.
---------------------------------------------

davidriver2000 06-19-2018 01:30 PM

Quote:

Originally Posted by business_kid (Post 5869231)
Linux is actually Gnu/Linux, and things like this have been working on computers since the earliest days.

It's a learning curve. Have you run lspci or lsusb?

I do not understand the terms and meanings you have about the following words?

lspci or lsusb !!!

I connected my SD card to the laptop's SD card, which goes directly to the main board of my laptop ) That pci interface (

michaelk 06-19-2018 07:17 PM

What is the make and model of your laptop? Some SD card readers require special drivers which are probably not included by default with kali.

lspci is a command that will display all devices connected to the PCI bus which should show the card reader.

widget 06-19-2018 09:29 PM

Yes it is a learning curve.

Your "command" of "/sys/block/mmcblk0/device/" is the address for a file.

All your usb ports connect directly to your MB too. This is a different type of interface than a pci interface. I have a very nice card reader but it plugs into an extra usb connection on my MB.

I don't have anything in my card reader but you can check on what is in your /sys directory with;
Code:

$ ls /sys
which will return something like
Code:

tom@stoned:~$ ls /sys
block  bus  class  dev  devices  firmware  fs  hypervisor  kernel  module  power

Note that I do have /sys/block. So we can move on a bit to;
Code:

tom@stoned:~$ ls /sys/block
sda  sdb  sdc  sdd  sde  sdf  sdg  sdh  sdi  sr0

where we see no sign of the next directory your "/sys/block/mmcblk0/device/" leads us too.

ls is "list". lsusb will list things connected to usb. lspci will list pci connected things.

There is very little danger in running commands at the $ prompt when dealing with system files. They belong to the user "root". The $ prompt only gives you the power that you as a normal user have. You can find who owns files easily (everything is a file in Linux including directories and devices) using;
Code:

tom@stoned:~$ ls -l /sys
total 0
drwxr-xr-x  2 root 0 0 Jun 19 14:24 block
drwxr-xr-x  32 root 0 0 Jun 19 14:24 bus
drwxr-xr-x  51 root 0 0 Jun 19 14:24 class
drwxr-xr-x  4 root 0 0 Jun 19 14:24 dev
drwxr-xr-x  16 root 0 0 Jun 19 14:24 devices
drwxr-xr-x  5 root 0 0 Jun 19 14:24 firmware
drwxr-xr-x  6 root 0 0 Jun 19 14:24 fs
drwxr-xr-x  2 root 0 0 Jun 19 14:24 hypervisor
drwxr-xr-x  12 root 0 0 Jun 19 14:24 kernel
drwxr-xr-x 149 root 0 0 Jun 19 14:24 module
drwxr-xr-x  2 root 0 0 Jun 19 14:24 power

which indicates that the user can execute and read the stuff but can't write which is where stuff gets screwed up (this is the column of "xr" entries).

Any actual damage needs permissions to write and that will require using sudo or logging into the terminal as root and using the # prompt.

That is where the FUN begins.

davidriver2000 06-22-2018 05:10 AM

and now how i can find my sd card drive ?
sda sdb sdc sdd sde sdf sdg sdh sdi sr0

davidriver2000 06-22-2018 01:30 PM

please read this instrumnet :
Project: Read, Collect & Decode SD Card CID Register Data
Buying flash memory from poorly reputed places, such as Chinese computer markets, and online auction sites is an often known way to collect BAD flash memory cards that fall short on performance, longevity and data security. SD cards, along with their “counterparts” mini and microSD cards, all contain manufacturer defined information in a set of registers. One is known as the CID, short for Card Identification Register. There is also another called the CSD or Card Specific Data Register. These can only be accessed directly via hardware and not via most card readers. I am aware that it was possible to do this via the SD Card Shield and Arduino, but since I have a Chromebook, things got really easy. Under the Chromebook, the SD reader slot on the side is directly connected to the SD bus of the ARM CPU and is not a USB based reader. By running Chrubuntu, getting the CID or CSD data from a card is as simple as:

cat /sys/block/mmcblk1/device/cid
cat /sys/block/mmcblk1/device/csd

Et voila! You will be rewarded with a hexadecimal string with the data in it. By comparing some cards that you own with the known signatures, you can have some reassurance whether your cards are similar, or genuine. Unfortunately, I haven’t seen a large CID database online, nor have I seen a CID decoder that will decode the hex string into the component parts (some BCD, some ASCII, others Unsigned Int or best as Hex), so I went on a journey to code one up for CID. I used this reference by Sandisk for the data field lengths and types. The CIDs for the cards I have in my possession that are in reach are as follows:

45010053454d31364790e03506aebf4d CHROMEBOOK INTERNAL EMMC
1b534d3030303030100337410200d13b RASPBMC SDHC CARD
1b534d3030303030107d11463800c199 SAMSUNG 32Gb CLASS 10 SDHC
8903034e43617264000000667000b285 TEAM 32Gb CLASS 10
41343253443132383002b800b600da6f KINGSTON 128Gb SDXC CLASS 10
02544d534430324728ad78243300793d KINGSTON 2Gb SDSC
035344534430324780019acc7600844b SANDISK 2Gb Blue SDSC
275048534433324730b018bd6700abe5 PATRIOT 32Gb CLASS 10 SDHC
035344535533324780718848c800b7fb SANDISK 32Gb CLASS 4 MicroSDHC
035344535530314780401c751300637d SANDISK ULTRA II 1Gb MicroSDSC
0353445355363447801013d98600d6d3 SANDISK ULTRA 64Gb UHS-I MicroSDXC
1234564d532020201000004c6300c853 UNBRANDED 2Gb MicroSDSC
8803023132333220100000cea40071b9 PRETEC 2Gb MicroSDSC

Please note, while the code below works using the Javascript of your browser, I have no prior Javascript coding until today, with much help from Google searches and W3schools. I won’t warrant the below decoder as being bug free, but it’s free so give it a whirl!



how i can recive this result ?
plz help :((

davidriver2000 06-23-2018 10:21 AM

No Body Any Body Here ??

C a n Y o u h e a r M E !!!!!

business_kid 06-24-2018 02:46 AM

I think so, but I don't think it's necessary to reinvent the wheel. Lsusb. Reads and interprets all that (gory details card details). The kernel reads it. We don't as a rule. You're boldly going where none of us have gone before. Please post your results.

jazzrock71 02-05-2019 07:52 AM

Hi to everybody,
I'm new in this kind of things ....
I'd like to change CID for an SD card, but before this I'd like to know if my SD has a editable CID.
I used a live version of UBUNTU mounted on USB pen
I inserted the SD card and opened a terminal

Quote:

To view the CID, the command is cat /sys/block/mmcblk0/device/cid (the exact location may be different)
What information is in the CID?
In fact ... I don't have the mmcblk0 folder (or device).
When I list the /sys/block folder I have this

http://i65.tinypic.com/wu1btc.jpg

Anyone can help?
How can I see if my Samsung EVO SD card has editable CID?


Thanks in advance

ondoho 02-05-2019 02:04 PM

i don't know what an editable CID is, but you can find out the name and path of the partition you want info about:
Code:

sudo fdisk -l

davidriver2000 07-01-2019 09:30 AM

Quote:

Originally Posted by jazzrock71 (Post 5957973)
Hi to everybody,
I'm new in this kind of things ....
I'd like to change CID for an SD card, but before this I'd like to know if my SD has a editable CID.
I used a live version of UBUNTU mounted on USB pen
I inserted the SD card and opened a terminal



In fact ... I don't have the mmcblk0 folder (or device).
When I list the /sys/block folder I have this

http://i65.tinypic.com/wu1btc.jpg

Anyone can help?
How can I see if my Samsung EVO SD card has editable CID?


Thanks in advance

AnyOne Find Any Way ???

I Need It
I Dont Like Lnux It is Very HARD LEARNING...

business_kid 07-02-2019 04:09 AM

At the level you're trying to go in at (Low Level) Linu8x is not easy, and this is not for the faint of heart.

Use the SD card as standard, and stop trying to tweak stupid details when you don't understand the implications. Why do you want to change the CID for the card? What is the CID anyhow? What effects will it have. There's no low hanging fruit in the way of performance waiting to be picked by fiddling a few numbers. Forget that.

Now please answer the questions you were asked, and post the results you were asked for and stop wasting everyone's time. That's how we make progress: our knowledge, & your work.


All times are GMT -5. The time now is 05:13 AM.