Serial number written to hardware?


7 posts
by GR-Thunderstorm » Mon Jul 16, 2012 9:46 am
I would like to know, if the unique serial number of each Raspi is written into some registers on the Board? If so, how could I read this information out using a C-program?
Posts: 34
Joined: Mon Dec 26, 2011 11:03 pm
by dom » Mon Jul 16, 2012 10:19 am
Try:
cat /proc/cpuinfo
Code: Select all
Processor   : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS   : 697.95
Features   : swp half thumb fastmult vfp edsp java tls
CPU implementer   : 0x41
CPU architecture: 7
CPU variant   : 0x0
CPU part   : 0xb76
CPU revision   : 7

Hardware   : BCM2708
Revision   : 0002
Serial      : 000000000000000d


Your serial should be different.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4013
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by GR-Thunderstorm » Mon Jul 16, 2012 11:40 am
Thx for your help. Yes this seems to be what I'm looking for. :)
I'm sorta newby to Linux so I gotta ask: How do I put this into C-code? This appears to be some command for the console.

Is it ok to just read the file directly from the SD-card without using any console-commands?


I wonder if there are differences between Farnell and Element 14 boards?
Last edited by GR-Thunderstorm on Mon Jul 16, 2012 11:55 am, edited 1 time in total.
Posts: 34
Joined: Mon Dec 26, 2011 11:03 pm
by PaulCheffus » Mon Jul 16, 2012 11:53 am
GR-Thunderstorm wrote:Thx for your help. Yes this seems to be what I'm looking for. :)
I'm sorta newby to Linux so I gotta ask: How do I put this into C-code? This appears to be some command for the console.


I wonder if there are differences between Farnell and Element 14 boards?


Hi

If I was doing this then I would read the file looking for the relevant tag such as Serial and read the value.

Cheers

Paul
Procrastination - The Thief of Time.
Posts: 372
Joined: Tue May 29, 2012 2:51 pm
Location: Lincolnshire UK
by GR-Thunderstorm » Mon Jul 16, 2012 11:56 am
PaulCheffus wrote:
GR-Thunderstorm wrote:Thx for your help. Yes this seems to be what I'm looking for. :)
I'm sorta newby to Linux so I gotta ask: How do I put this into C-code? This appears to be some command for the console.


I wonder if there are differences between Farnell and Element 14 boards?


Hi

If I was doing this then I would read the file looking for the relevant tag such as Serial and read the value.

Cheers

Paul


Yes this was my intention. I just didn't know that this "cat" command actually just reads out some file from the harddrive until I just tried it in a virtual machine on my PC.

Thanks alot for your help guys!
Posts: 34
Joined: Mon Dec 26, 2011 11:03 pm
by RaTTuS » Mon Jul 16, 2012 12:17 pm
the /proc/ directory is not on the HD [more accurately the SD card] it is a device and can be read as a file
actually in linux [and unix] everything can be considered as a file and all you need is read / write access to the file for manipulation [YMMV]
...

so you just use the standard IO libraries to read the file
1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX - Prosliver FTW
"That's not right, the badgers have moved the goalposts."
User avatar
Posts: 5003
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
by AndrewS » Thu Jul 26, 2012 1:33 pm
There's more discussion about serial numbers here: viewtopic.php?f=29&t=8985
User avatar
Posts: 3580
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK