Files
the_kurgan/kurgan/hw/__init__.py
T
paulandClaude Opus 5.5 b1404ac4ba Privilege split 2/11: the hardware service's pipe protocol
- kurgan/hw/protocol.py: newline-delimited JSON between the app and the
  coming kurgan.hw service. Requests {"op", "args", "id"}; replies {"id",
  "ok", "result"|"error": {"code", "message"}}. Operations: hello (protocol
  and service versions; required first on every connection), state,
  set_profile, set_ram_lighting, and ram_chase, which carries the app's chase
  clock so the RAM stays in step with the case fan and GPU chases.
- Strict: a 64 KiB line cap (an oversized line closes the connection),
  unknown operations and fields, missing or mistyped arguments, NaN and
  Infinity, duplicate keys and deep nesting are all rejected. Profiles and RAM
  modes are checked against the same lists the web API uses, on both sides:
  the client encodes through the same checks before sending.
- Session: one connection's state machine (hello first, a version mismatch is
  answered then closed, operation errors map to invalid/unavailable/internal,
  a reply that can't be encoded is an internal error, not a dead connection).
- Tests: 15 new (malformed, oversized and unknown input, version mismatch).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-05 19:17:36 +13:00

14 lines
698 B
Python

"""The hardware service: the only part of The Kurgan that runs with admin rights.
`kurgan.hw` is a Windows service (LocalSystem, started at boot) that owns the hardware the
unelevated app must not touch:
fan control Commander PRO case fans and motherboard top fans, profiles and fail-safes,
with its own CPU (PawnIO MSR) and GPU (NVML) temperature readings
RAM lighting the Dominator DDR5 sticks over the SMBus (PawnIO)
The app (web UI, proxy, AI servers, telemetry, LCD, the other lighting, tray) talks to it over
the named pipe \\\\.\\pipe\\kurgan-hw (protocol.py). The service never depends on the app: with
no client connected it keeps controlling the fans.
"""