LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 06-19-2018, 06:23 AM   #1
davidriver2000
LQ Newbie
 
Registered: Jun 2018
Posts: 6

Rep: Reputation: Disabled
Unhappy 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/
 
Old 06-19-2018, 08:01 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 9,930

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
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?
 
Old 06-19-2018, 01:24 PM   #3
davidriver2000
LQ Newbie
 
Registered: Jun 2018
Posts: 6

Original Poster
Rep: Reputation: Disabled
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.
---------------------------------------------
 
Old 06-19-2018, 01:30 PM   #4
davidriver2000
LQ Newbie
 
Registered: Jun 2018
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by business_kid View Post
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 (
 
Old 06-19-2018, 07:17 PM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 18,220

Rep: Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546
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.
 
Old 06-19-2018, 09:29 PM   #6
widget
Senior Member
 
Registered: Oct 2008
Location: S.E. Montana
Distribution: Debian Testing, Stable, Sid and Manjaro, Mageia 3, LMDE
Posts: 2,628

Rep: Reputation: 496Reputation: 496Reputation: 496Reputation: 496Reputation: 496
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.
 
Old 06-22-2018, 05:10 AM   #7
davidriver2000
LQ Newbie
 
Registered: Jun 2018
Posts: 6

Original Poster
Rep: Reputation: Disabled
and now how i can find my sd card drive ?
sda sdb sdc sdd sde sdf sdg sdh sdi sr0
 
Old 06-22-2018, 01:30 PM   #8
davidriver2000
LQ Newbie
 
Registered: Jun 2018
Posts: 6

Original Poster
Rep: Reputation: Disabled
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 (
 
Old 06-23-2018, 10:21 AM   #9
davidriver2000
LQ Newbie
 
Registered: Jun 2018
Posts: 6

Original Poster
Rep: Reputation: Disabled
No Body Any Body Here ??

C a n Y o u h e a r M E !!!!!
 
Old 06-24-2018, 02:46 AM   #10
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 9,930

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
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.
 
Old 02-05-2019, 07:52 AM   #11
jazzrock71
LQ Newbie
 
Registered: Feb 2019
Posts: 2

Rep: Reputation: Disabled
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
 
Old 02-05-2019, 02:04 PM   #12
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 11,062
Blog Entries: 7

Rep: Reputation: 2794Reputation: 2794Reputation: 2794Reputation: 2794Reputation: 2794Reputation: 2794Reputation: 2794Reputation: 2794Reputation: 2794Reputation: 2794Reputation: 2794
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
internal adsl card berrance Linux - Hardware 4 04-11-2011 10:23 PM
Need help setting up an internal TV Card jadukor SUSE / openSUSE 2 01-28-2011 01:46 PM
Internal TV Tuner - how to find more information Snipersnest Linux - Hardware 5 10-09-2008 05:49 AM
Using Internal Wi-Fi Card CrownAmbassador Linux - Hardware 26 01-31-2008 07:16 PM
How can I get internal function information from a object file SybaseLu Programming 3 08-03-2007 09:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration