From 711277131acb00bb685be46b5ee7daafaf8c92e1 Mon Sep 17 00:00:00 2001 From: serversdown Date: Thu, 15 Oct 2026 12:28:40 -0400 Subject: [PATCH 1/9] feat(micromate): a config diff harness -- and the blocks turn out to be bit-stable The Series III config map was built by changing one setting and seeing which bytes moved. Whether that method transfers to Series IV depended on an unmeasured question: how much of a config block moves ON ITS OWN. If a block carries a clock or a counter, every diff arrives polluted and there is no way to tell the real answer from the noise in a single pair. MEASURED ON UM20147 (11.0BD), FOUR READS BACK TO BACK, NOTHING TOUCHED: 0x1A compliance 2103 B 0 bytes moved 0x2C call home 137 B 0 0x2E trigger 39 B 0 0x08 event index 101 B 0 0x01 device info 163 B 0 0x1C monitor status 59 B 2 (and those two are explained below) Every config block held every byte still, so the method transfers directly and needs no noise floor subtracted. That was the open question. scratch/mm_config_diff.py drives it: `volatile` establishes the floor, `snap` saves a labelled read of all five blocks, `diff` reports changed runs with each plausible field interpretation (u8/u16be/u32be/f32be) and reports any volatile bytes separately rather than silently hiding them. CORRECTION TO content[6] OF 0x1C, long recorded only as "NOT the hour": it is a sub-second tick, ~4020 counts/second in steps of exactly 4, wrapping at 256 -- about a 64 ms period, consistent with the low 6 bits of a millisecond counter. Consequence worth knowing: a 0x1C block is never byte-identical to itself, so any "has the status block changed?" check answers yes ~15 times a second. Compare named fields, never whole blocks. I nearly recorded that byte wrong, and the trap is cheap enough to document: sampled once per second it reads as a smooth monotonic counter at ~16/s with a 16-second wrap. Twelve consecutive samples supported it. It is aliasing -- a 64 ms counter read once a second is noise that happens to look tidy. Measure a counter back to back before trusting any rate from spaced samples. Also: the settings do not have to be changed from THOR. The unit's own keypad works, which needs no Windows VM and does not contend for the modem's single TCP session. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL --- .gitignore | 3 + docs/micromate_protocol_reference.md | 43 +++++ micromate/client.py | 2 +- scratch/mm_config_diff.py | 254 +++++++++++++++++++++++++++ 4 files changed, 301 insertions(+), 1 deletion(-) create mode 100644 scratch/mm_config_diff.py diff --git a/.gitignore b/.gitignore index d6d14bf..cd2de96 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,6 @@ claude_export_*.md *.db *.db-wal *.db-shm + +# Config-block snapshots from scratch/mm_config_diff.py (device dumps, not source) +scratch/mm_config_snaps/ diff --git a/docs/micromate_protocol_reference.md b/docs/micromate_protocol_reference.md index 348ebba..a814bf0 100644 --- a/docs/micromate_protocol_reference.md +++ b/docs/micromate_protocol_reference.md @@ -346,6 +346,49 @@ certainly per-channel calibration/scale factors, by analogy with Series III's The battery reading independently corroborates: Thor's own event reports for these units print `BatteryLevel : 3.8 volts`. +**⚠ `content[6]` is a sub-second tick, not a status field (UM20147, 2026-10-15).** +Long recorded only as "NOT the hour". Read back to back it advances +**~4,020 counts/second in steps of exactly 4, wrapping at 256** — a period of +about **64 ms**, consistent with the low 6 bits of a ~1 kHz millisecond counter +scaled by 4. + +⚠ **Practical consequence: a `SUB 0x1C` block is never byte-identical to itself.** +Any check of the form "has the status block changed?" answers *yes* on every +read, roughly 15 times a second. Compare named fields, never whole blocks. +`content[9]` (seconds) is the only other byte that moves on an idle unit. + +⚠ **How this was nearly recorded wrong, because the trap is cheap to fall into.** +Sampled once per second it looks like a smooth, monotonic counter advancing +~16 per second with a 16-second wrap — a clean, plausible, entirely false +reading, because once-per-second sampling of a 64 ms counter is aliased. Twelve +consecutive samples supported it. **Measure a counter back to back before +believing any rate derived from spaced samples.** + +### The config blocks are bit-stable — which is what makes a diff loop viable + +Measured on UM20147 (`11.0BD`), four reads back to back with nothing touched: + +| block | size | bytes that moved on their own | +|---|---|---| +| `0x1A` compliance | 2,103 B | **0** | +| `0x2C` call home | 137 B | **0** | +| `0x2E` trigger | 39 B | **0** | +| `0x08` event index | 101 B | **0** | +| `0x01` device info | 163 B | **0** | +| `0x1C` monitor status | 59 B | 2 (`content[6]` tick, `content[9]` seconds) | + +Every config block held every byte still. **So the Series III method applies +directly: change exactly one setting, re-read, and any byte that moved is that +setting.** No noise floor to subtract and no repeat-sampling needed to +distinguish a field from a counter — which was the open question about whether +this approach would work at all here. + +Harness: `scratch/mm_config_diff.py` (`volatile` / `snap` / `diff`), read-only. + +⚠ The settings do **not** have to be changed from THOR. They can be changed on +the unit's own keypad, which avoids contending with anything for the modem's +single TCP session and needs no Windows VM. + **`SUB 0x2C` — call-home config.** Contains the ASCII string `RADIO RING`. Worth flagging: that is the *exact* string seen in the RV50 `ALEOS_SERIAL` debug during the BE12599 incident — diff --git a/micromate/client.py b/micromate/client.py index 67f47e3..98be3ae 100644 --- a/micromate/client.py +++ b/micromate/client.py @@ -54,7 +54,7 @@ _STATE_FLAG = 0 # 0x49: 0x00 idle, 0x02 monitoring _MS_FLAG = 1 # 0x1C: monitoring flag — test NON-ZERO _MS_DAY, _MS_MONTH, _MS_YEAR = 2, 3, slice(4, 6) -_MS_UNKNOWN_6 = 6 # ⚠ NOT the hour — see read note below +_MS_UNKNOWN_6 = 6 # ⚠ sub-second tick (~4020/s, step 4, 64 ms wrap) — NOT the hour _MS_HOUR, _MS_MIN, _MS_SEC = 7, 8, 9 _MS_BATTERY = slice(34, 36) # uint16 BE, volts × 100 _MS_MEM_TOTAL = slice(36, 40) # uint32 BE diff --git a/scratch/mm_config_diff.py b/scratch/mm_config_diff.py new file mode 100644 index 0000000..f2f7b25 --- /dev/null +++ b/scratch/mm_config_diff.py @@ -0,0 +1,254 @@ +#!/usr/bin/env python3 +"""mm_config_diff.py — snapshot a Micromate's config blocks and diff them. + +**Read-only.** Sends only the five config reads plus POLL/SERIAL. It never +writes, never erases, never starts or stops monitoring. + +Why it exists +------------- +`docs/micromate_protocol_reference.md` has about a dozen fields read out of +`SUB 0x1A` (2,103 bytes) and *nothing* out of `0x2C`, `0x2E`, `0x08` or `0x01`. +They are fetched and undecoded. The method that mapped the Series III config +was a diff loop: change exactly one setting, re-read, see which bytes moved. +This is that loop for Series IV. + +The one thing that loop needs first +----------------------------------- +**Which bytes move on their own.** A config block read twice, thirty seconds +apart, with nothing touched, is not byte-identical — it carries a clock, a free +-memory figure and at least one counter. Diff two snapshots taken either side +of a setting change and those bytes show up alongside the real answer, and +there is no way to tell which is which from a single pair. + +So `volatile` runs first: N reads back to back, nothing changed, and every byte +that differs is recorded as noise. `diff` then reports the two sets +separately. Without that baseline a diff is suggestive; with it, it is +evidence. + +Usage +----- + # establish the noise floor FIRST -- nothing touched between reads + python3 scratch/mm_config_diff.py /dev/ttyACM0 volatile -n 4 + + # baseline, then change ONE setting on the unit's keypad, then: + python3 scratch/mm_config_diff.py /dev/ttyACM0 snap before + python3 scratch/mm_config_diff.py /dev/ttyACM0 snap after-rectime-4s + python3 scratch/mm_config_diff.py /dev/ttyACM0 diff before after-rectime-4s + +Snapshots live in `scratch/mm_config_snaps//