fix(tooling): mm_client_check reported THOR's request count, not its own
The download line computed `size // 1024` -- THOR's chunk size -- while the download used the 16 KB default. So a 72,560 B event that took 5 requests was printed as "71 chunks", and I nearly read a working 16 KB download as a broken 1 KB one. A diagnostic that misreports what it did is worse than one that says nothing. Now prints the real count and the size used: "5 req @ 16384 B". Verified by counting the frames in a capture of that run: 5 x SUB 0x5A at offsets 0x4000 0x4000 0x4000 0x4000 0x1b70, summing to exactly 72,560. That is also the FIRST time the 16 KB chunk size has run through the real download loop on hardware -- previously only the probe had issued 16 KB single requests, and the loop itself had only been exercised at 1024 B against THOR's frames and at 16 KB against simulated responses. Also recorded: USB identification for the Micromate's own ports. Its PC port is 2504:0300 (Instantel Inc. MICROMATE COM PORT), appearing as CDC-ACM, against 0403 FTDI and 067b Prolific for the USB-A host-port cables. Address it by /dev/serial/by-id/ and not /dev/ttyACM<n>, because the number moves whenever another CDC-ACM device appears -- which has already cost a session aimed at a TMI-Seismo MCU by mistake. And: passing one through to a Proxmox guest hot-plugs with no VM restart via `qm set <vmid> -usb0 host=2504:0300`. UM20147 is now on tmi-dev (10.0.0.44) this way, which means the unit can be driven from the dev VM directly instead of relaying commands. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ru8Lg9HkkYvX9VWWo65SmL
This commit is contained in:
1 parent
bdf4909d2a
commit
67de2c18da
2 files changed
+33
-4
No files matched your search
@@ -55,7 +55,7 @@ from pathlib import Path
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
|
||||
|
||||
from micromate.client import MicromateClient, _content # noqa: E402
|
||||
from micromate.protocol import ProtocolError # noqa: E402
|
||||
from micromate.protocol import CHUNK_SIZE, ProtocolError # noqa: E402
|
||||
from minimateplus.transport import TcpTransport # noqa: E402
|
||||
|
||||
|
||||
@@ -380,7 +380,14 @@ def main() -> int:
|
||||
for ref in mm.iter_events():
|
||||
if ref.key_hex not in want_keys:
|
||||
continue
|
||||
n_chunks = -(-ref.size // 1024)
|
||||
# ⚠ Use the size actually requested. This printed
|
||||
# `size // 1024` -- THOR's chunk size -- while the
|
||||
# download used the 16 KB default, so it reported 71
|
||||
# requests for a walk that made 5. A diagnostic that
|
||||
# misreports what it did is worse than one that says
|
||||
# nothing, and this one nearly had me reading a working
|
||||
# 16 KB download as a broken 1 KB one.
|
||||
n_chunks = -(-ref.size // CHUNK_SIZE)
|
||||
note = (" <- past 64 KB, carries into params[1]"
|
||||
if ref.size > 0x10000 else "")
|
||||
t1 = time.monotonic()
|
||||
@@ -396,8 +403,8 @@ def main() -> int:
|
||||
check = ("PVS %+.4f%%" % (100 * err) if err is not None
|
||||
else "PVS n/a (histogram)")
|
||||
print(f" {ref.key_hex} {ref.record_type:9} "
|
||||
f"{ref.size:7} B {n_chunks:3} chunks {dt:5.1f} s "
|
||||
f"{n:6} samples {check}{note}")
|
||||
f"{ref.size:7} B {n_chunks:3} req @ {CHUNK_SIZE} B "
|
||||
f"{dt:5.1f} s {n:6} samples {check}{note}")
|
||||
|
||||
except ProtocolError as e:
|
||||
print(f"\n ABORTED {type(e).__name__}: {e}")
|
||||
|
||||
@@ -1662,6 +1662,28 @@ through a record-type discriminator (`0x2C` partial vs `0x46` full) *on its
|
||||
event walk*, so partial records and events share one chain. Here the monitor
|
||||
log has its own cursor and the event chain never sees it.
|
||||
|
||||
### USB identification — the Micromate's own ports
|
||||
|
||||
| device | VID:PID | appears as |
|
||||
|---|---|---|
|
||||
| **Micromate `PC` port (USB-B)** | **`2504:0300`** — *Instantel Inc. MICROMATE COM PORT* | `/dev/ttyACM*`, CDC-ACM |
|
||||
| Sabrent cable (works on the USB-A host port) | `0403:*` — FTDI | `/dev/ttyUSB*` |
|
||||
| Benfei cable (does **not** work) | `067b:*` — Prolific PL2303 | `/dev/ttyUSB*` |
|
||||
|
||||
⚠ **Address the unit by `/dev/serial/by-id/`, not `/dev/ttyACM<n>`.** The number
|
||||
shifts whenever any other CDC-ACM device is plugged in, and this has already cost
|
||||
a debugging session — the tool was aimed at a TMI-Seismo MCU and timed out
|
||||
looking like a dead unit. The stable name is
|
||||
`usb-Instantel_Inc._MICROMATE_COM_PORT_V1.00-if00`.
|
||||
|
||||
The `PC` port is a USB **device** port, so it is safe to plug and unplug freely.
|
||||
The cold-boot requirement applies only to the USB-A **host** port, where the
|
||||
modem cable goes.
|
||||
|
||||
**Passing one through to a Proxmox guest** works and hot-plugs, no VM restart:
|
||||
`qm set <vmid> -usb0 host=2504:0300`. Bind by VID:PID rather than bus-port so it
|
||||
survives a replug.
|
||||
|
||||
#### 🔑 Every response has an 11-byte prefix — and its length byte lies
|
||||
|
||||
**Content starts at `data[11]`.** One rule, every command.
|
||||
|
||||
Reference in new issue
Block a user