Page 1 of 1

Get MAC address using espefuse

Posted: Mon Apr 22, 2024 2:47 pm
by cskilbeck
Hi, I can get the MAC address using espefuse but it means extracting it from the output using sed or some similar pattern matching tool. This isn't ideal as the format of the output from espefuse isn't guaranteed. Is there a method to get the MAC address in a more defined way?

Thanks,
Charlie.

For reference, the output from espefuse summary contains this fragment:

Code: Select all

MAC (BLOCK1)                                       MAC address
   = ec:da:3b:51:bb:a4 (OK) R/W
CUSTOM_MAC (BLOCK3)                                Custom MAC
   = 00:00:00:00:00:00 (OK) R/W
[/code]

Re: Get MAC address using espefuse

Posted: Mon Apr 22, 2024 3:54 pm
by liaifat85
You can try the 'grep' and 'awk' commands.

Re: Get MAC address using espefuse

Posted: Mon Apr 22, 2024 4:07 pm
by cskilbeck
Sure, but unless the output format is guaranteed not to change then it could break when the espefuse tool is updated.

Re: Get MAC address using espefuse

Posted: Tue Apr 23, 2024 12:40 am
by ESP_Sprite
espefuse is a Python script that you can also use as a library in your own Python scripts. Technically I don't think we promise anything about the API we provide there, but I imagine it's going to be more stable (and visible if it breaks) than parsing the output.

Re: Get MAC address using espefuse

Posted: Tue Apr 23, 2024 5:31 am
by ESP_Roland

Code: Select all

espefuse.py --port <PORT> summary --format value_only MAC
This will be supported from the upcoming v4.8 release of esptool.