Get MAC address using espefuse

cskilbeck
Posts: 11
Joined: Tue Dec 10, 2019 10:40 pm

Get MAC address using espefuse

Postby cskilbeck » Mon Apr 22, 2024 2:47 pm

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]

liaifat85
Posts: 200
Joined: Wed Dec 06, 2023 2:46 pm

Re: Get MAC address using espefuse

Postby liaifat85 » Mon Apr 22, 2024 3:54 pm

You can try the 'grep' and 'awk' commands.

cskilbeck
Posts: 11
Joined: Tue Dec 10, 2019 10:40 pm

Re: Get MAC address using espefuse

Postby cskilbeck » Mon Apr 22, 2024 4:07 pm

Sure, but unless the output format is guaranteed not to change then it could break when the espefuse tool is updated.

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: Get MAC address using espefuse

Postby ESP_Sprite » Tue Apr 23, 2024 12:40 am

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.

User avatar
ESP_Roland
Posts: 265
Joined: Tue Oct 09, 2018 10:28 am

Re: Get MAC address using espefuse

Postby ESP_Roland » Tue Apr 23, 2024 5:31 am

Code: Select all

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

Who is online

Users browsing this forum: No registered users and 225 guests