From f2f2dbd5eb3c85ef1621eef904c2db4a2c6c81cf Mon Sep 17 00:00:00 2001 From: Ryan Malloy Date: Fri, 30 Jan 2026 20:52:09 -0700 Subject: [PATCH] Fix eFuse summary parser for espefuse v5.x output format The R/W permission field uses 'R/W' not just 'R' at end of line, and values can be 'False', '0', hex, or binary representations. --- .../components/security_manager.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/mcp_esptool_server/components/security_manager.py b/src/mcp_esptool_server/components/security_manager.py index 1e62774..e361039 100644 --- a/src/mcp_esptool_server/components/security_manager.py +++ b/src/mcp_esptool_server/components/security_manager.py @@ -400,15 +400,18 @@ class SecurityManager: def _parse_efuse_summary(self, output: str) -> dict[str, str]: """Parse espefuse summary output into a dict of name -> value. - espefuse summary lines look like: - EFUSE_NAME (BLOCK0) = 0x00000000 R/W - or: - MAC (BLOCK0) = ab:cd:ef:01:02:03 R/W + espefuse v5.x summary lines look like: + ADC_VREF (BLOCK0) True ADC reference voltage = 1100 R/W (0b00000) + MAC (BLOCK0) Factory MAC address = ab:cd:ef:01:02:03 R/W (0x...) + The value sits between '= ' and the R/W permission field. """ efuses: dict[str, str] = {} for line in output.splitlines(): - # Match lines with "NAME (BLOCKn) ... = value" - match = re.match(r"\s*(\w+)\s+\(BLOCK\d+\)\s+.*?=\s+(.+?)\s+[RW/-]+\s*$", line) + # Match: NAME (BLOCKn) = R/W|R/-|-/- () + match = re.match( + r"\s*(\w+)\s+\(BLOCK\d+\)\s+.*?=\s+(.+?)\s+[RW/-]+/[RW/-]+\s", + line, + ) if match: name = match.group(1).strip() value = match.group(2).strip()