The docs describe how the mac address is linked to the SOM serial number here MAC Address | Toradex Developer Center (if the mac address has not be forced to another value). Could you provide some python script in addition to the MAC Address | Toradex Developer Center for linux users (or other users which do not have ms excel)?
You can use this formula:
serial = int('<Serial#>')
print("00:14:2D:" + format((serial >> 16) & 0xFF, '02X') + ':' + format((serial >> 8) & 0xFF, '02X') + ':' + format(serial& 0xFF, '02X'))
Great, thanks a lot!
…but I need the other way around: mac → serno
Here:
mac = '<MAC>'
serial = (int(mac[9:11], 16) << 16) + (int(mac[12:14], 16) << 8) + int(mac[15:17], 16)
format(serial, '08d')
Thanks a lot!
BTW: The serial number also gets passed from U-Boot via device tree:
root@apalis-tk1:~# cat /proc/device-tree/serial-number; echo
02858976
The prefix 00:14:2D is independent of the TK1 SOM HW version (V1.1A vs. V1.2A), right?
Yes, that’s the Toradex OUI (Organizationally Unique Identifier).
Great, thx.
you are welcome.
I understand this is an old post, but I’m running into an issue trying to mac-to-serial the second mac address. The issue I’m seeing is that the second mac address generates a valid serial number, but it’s not the serial number of the device. I understand that if I knew I was looking at the second mac address then I could subtract 0x100000, but when I see the mac address from the network (nmap scan) I cannot tell whether I’m on the first or second ethernet.
Is there any extra info I can use to determine whether I’m looking at the first or second mac address?
Have you checked this page?
Also, on the device, there is this script that is called by the set-hostname.service
/usr/bin/sethostname
If you have further questions,
could you open a new thread so we can keep a better track of it?