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.
This commit is contained in:
parent
945939bdad
commit
f2f2dbd5eb
@ -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) <description> = <value> R/W|R/-|-/- (<hex>)
|
||||
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()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user