[Linux] Print Out the MAC address in Linux Kernel
In Linux Kernel, we want to print out the mac address information, we can use this pattern.
[sourcecode language=”c”]
printk("mac address: %02x:%02x:%02x:%02x:%02x:%02x",
node_id[0] & 0xff, (node_id[0]>>8) & 0xff,
node_id[1] & 0xff, (node_id[1]>>8) & 0xff,
node_id[2] & 0xff, (node_id[2]>>8) & 0xff);
[/sourcecode]
發佈留言
很抱歉,必須登入網站才能發佈留言。