This repository was created with git subtree split --prefix=host from the Host-bearing origin/dev history. Split tip: cf5fa387f273ec1a8254d2d7f8ed3bf131865122. It is not a copy presented as preserved history.
The existing door-percent API remains migration/Legacy code. The 6400 path imports the generated target/ACK/snapshot contract and exposes set_target, stop, get_snapshot, capture_snapshot, and Identification-only run_stimulus through the existing gRPC-over-UDS service boundary.
Only hthd opens a serial path. Lab and notebooks must use the Python SDK. Hardware, COM, and real UART validation are NOT RUN.
Use one of the strict example configurations:
deploy/examples/hthd.6400-mock.yamldeploy/examples/hthd.6400-replay.yamldeploy/examples/hthd.6400-serial.yamlproduct: 6400-front-rear-v1 selects the autonomous thermal path without enabling the Legacy poller, lease, SET_ALL heartbeat, or Host watchdog. thermal.firmware_profile accepts exactly the canonical profiles 6400-control, 6400-identification, and 6400-sim-debug. The old production and identification aliases are rejected. 6400-control rejects stimulus; the other two profiles support it, and 6400-sim-debug is simulation-only.
The daemon holds one global transaction lock. Every legal Host command waits for an independent zero-payload ACK: SET_TARGET waits for 0x81, GET_SNAPSHOT waits for 0x82, and supported SET_STIMULUS waits for 0x83. GET_SNAPSHOT then waits for the distinct 0x42 Snapshot Data frame. Its 0x82 -> 0x42 sequence is consumed by one mutex, one stream parser, and one retry attempt, including when both frames arrive in a single read. The retired 0x82 Snapshot Data form is rejected. A successful command result means the CPLD committed the command; it never means that the requested temperature was reached.
The observe and control services remain on different UDS endpoints:
observe socket: ThermalObserveService.GetSnapshot / CaptureSnapshot
control socket: ThermalControlService.SetTarget / Stop / RunStimulus
The snapshot response preserves the exact generated 193-byte wire payload in raw_payload and also exposes decoded fields. Offsets, command values, canonical profiles, and golden frames come from the imported CPLD contract; do not duplicate them in clients. generated/6400/import-source.json binds the functional CPLD source commit separately from the later package-only commit, and also binds the contract, golden vectors, source closure, every RTL input, and the cosim wrapper by exact SHA-256. A package-only commit is not claimed as a TD/bitstream rebuild.
Start hthd with the mock example, then run:
hthctl --observe-sock /tmp/hth-6400-mock/observe.sock --device prod2u-6400-0 thermal-snapshot
hthctl --observe-sock /tmp/hth-6400-mock/observe.sock --control-sock /tmp/hth-6400-mock/control.sock --device prod2u-6400-0 --target 65 set-target
hthctl --observe-sock /tmp/hth-6400-mock/observe.sock --control-sock /tmp/hth-6400-mock/control.sock --device prod2u-6400-0 stop
hth-capture --thermal --observe-sock /tmp/hth-6400-mock/observe.sock --device prod2u-6400-0 --out /tmp/hth-6400-capture --duration 10s --period 200ms
Thermal capture writes length-prefixed raw-frames.bin, thermal-snapshots.jsonl, run.json, and checksums.sha256 without opening serial itself.
run-stimulus requires an explicit JSON file containing duration_seconds, exactly 24 ptc_duty values, four front_fan_duty values, and four rear_fan_duty values. It is valid only with Identification firmware. The CLI still requires --i-understand-this-is-real-hardware for any mutating command when ListDevices reports a serial backend; this flag does not authorize this repository's tests to touch hardware.
The Legacy five-symbol top-level facade remains unchanged. Import the 6400 client explicitly:
from hth_sdk.thermal import connect_thermal
with connect_thermal(
device_id="prod2u-6400-0",
observe_socket="/tmp/hth-6400-mock/observe.sock",
control_socket="/tmp/hth-6400-mock/control.sock",
firmware_profile="6400-control",
) as hth:
hth.set_target(65)
snapshot = hth.capture_snapshot()
assert len(snapshot.payload) == 193
hth.stop()
The SDK uses synchronous gRPC over UDS and contains no serial open path. Every command or snapshot response is rejected if its canonical firmware profile or generated contract SHA-256 differs from the requested binding.
Replay is strict JSONL. Each nonblank line contains exactly one JSON object and exactly one of:
{"ack":true,"payload_hex":"<exact 193-byte snapshot encoded as hex>"}
{"ack":false,"error":"ack-timeout"}
{"ack":false,"error":"ack-crc"}
{"ack":false,"error":"ack-type"}
{"ack":true,"error":"data-timeout"}
{"ack":true,"error":"data-crc"}
Snapshot data and data-stage errors require an explicit successful GET ACK. ACK-stage failures must not claim an ACK. Unknown fields, ambiguous old error names, trailing JSON values, malformed hex, and wrong payload lengths are rejected when the backend opens. Replay is observe-only; target, stop, and stimulus return failed-precondition through gRPC.