fix(sfm): a Micromate's call-home is refused while monitoring, and only a real call-home block is ever edited
Measured at the bench 2026-11-03 (UM20147): monitoring, a Micromate returns its real call-home block and ACKS a call-home write, but does not apply it -- three read-backs unchanged, and its own menu says 'Feature disabled while monitoring'. SFM now refuses up front (UnitStateUnknown, 409: '... is monitoring -- a Micromate ignores call-home changes while monitoring ...; stop monitoring first -- nothing sent'), dry run included, instead of sending a write the unit ignores. And the block must be the call-home block: micromate.writes.is_call_home_content checks its header is its own length (00 7C, N = 124 -- 00 7C DC on every read, UM12947 and UM20147). plan_call_home_enabled refuses any other 126 bytes, the change refuses before sending, and call_home_state says why (enabled = None). At the bench this was checked by eye before the monitoring write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
1 parent
5326e99ac2
commit
f35845d403
4 files changed
+74
-4
No files matched your search
@@ -101,6 +101,13 @@ def plan_stop_monitoring() -> WritePlan:
|
||||
return WritePlan("stop monitoring", (WriteStep(0x97, _CONFIRM, what="stop monitoring"),))
|
||||
|
||||
|
||||
def is_call_home_content(block: bytes) -> bool:
|
||||
"""Whether 126 bytes are the 0x2C call-home content: its header is its own
|
||||
length (00 7C, N = 124 -- 00 7C DC on every read on record, UM12947 and
|
||||
UM20147). A bit is flipped only in a block that carries it."""
|
||||
return len(block) == _CALL_HOME_LEN and int.from_bytes(block[0:2], "big") == _CALL_HOME_LEN - 2
|
||||
|
||||
|
||||
def plan_call_home_enabled(call_home: bytes, enabled: bool) -> WritePlan:
|
||||
"""Read `0x2C`, flip bit 0 of content[5], send the rest back byte for byte.
|
||||
|
||||
@@ -113,6 +120,9 @@ def plan_call_home_enabled(call_home: bytes, enabled: bool) -> WritePlan:
|
||||
if len(call_home) != _CALL_HOME_LEN:
|
||||
raise ValueError(f"call-home content must be {_CALL_HOME_LEN} B "
|
||||
f"(the size THOR's offset was seen at), got {len(call_home)}")
|
||||
if not is_call_home_content(call_home):
|
||||
raise ValueError(f"call-home content's header is {call_home[0:2].hex()}, not its own length "
|
||||
f"(00 {_CALL_HOME_LEN - 2:02x}) -- not the call-home block; nothing built")
|
||||
b5 = (call_home[5] | 0x01) if enabled else (call_home[5] & 0xFE)
|
||||
data = call_home[:5] + bytes([b5]) + call_home[6:]
|
||||
what = "call-home " + ("enable" if enabled else "disable")
|
||||
|
||||
Reference in new issue
Block a user