Last active
December 28, 2015 22:49
-
-
Save jadonk/7573999 to your computer and use it in GitHub Desktop.
Read the serial number and unused MAC ID off of a BeagleBone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| root@ubuntu-armhf:~# ./parse-eeprom | |
| c8:a0:30:ac:e0:be | |
| A335BNLT 0A5A 1513BBBK0837 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/perl | |
| undef $/; | |
| open($maf, "</proc/device-tree/ocp/ethernet\@4a100000/slave\@4a100300/mac-address"); | |
| $ma = <$maf>; | |
| @ADDR = unpack("(H2)*", $ma); | |
| $DEV_ADDR = join(":", @ADDR); | |
| print "$DEV_ADDR\n"; | |
| open($eef, "</sys/bus/i2c/devices/0-0050/eeprom"); | |
| $ee = <$eef>; | |
| ($HEADER,$ID,$VERSION,$SERIAL) = unpack("A4A8A4A12", $ee); | |
| print "$ID $VERSION $SERIAL\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment