Privilege split 11/11: docs for the two-process Kurgan

- README: how it's split (the hardware service and the app), what setup.ps1
  now does, updating from the elevated version, a security model section
  (what the pipe allows and checks, the unelevated app, and that this is not
  a boundary against malware running as the user: the service runs code from
  user-writable folders), where each setting lives (hw-settings.json and the
  legacy sections), the 503s, the service log, identifying fan ports with the
  service stopped, running either part by hand, and the new layout.
- The USB hub note, in the README and case_fans.py: the LCD is now on a
  back-panel port (Intel root hub); the CORE shares the Genesys hub with the
  Commander PRO. The ~22 frames/s cap stays as a margin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
paulandClaude Opus 5.5 committed 2026-12-05 19:54:50 +13:00
1 parent 0d5f470c4a
commit 04fee83542
2 files changed
+138 -53

No files matched your search

+134 -51
View File
@@ -2,20 +2,38 @@
![The Kurgan's sword](kurgan/assets/sword.png) ![The Kurgan's sword](kurgan/assets/sword.png)
One process that runs this PC's backend systems, with one web UI at **<http://127.0.0.1:8080/>**: Runs this PC's backend systems, with one web UI at **<http://127.0.0.1:8080/>**:
| Capability | What it does | Package | | Capability | What it does | Package |
| --- | --- | --- | | --- | --- | --- |
| Telemetry | CPU, GPU and whole-PC power readings, once a second, with 10 minutes of history | `kurgan/telemetry` | | Telemetry | CPU, GPU and whole-PC power readings, once a second, with 10 minutes of history | `kurgan/telemetry` |
| Display | The CPU/GPU/power dashboard on the Thermaltake 3.9" LCD | `kurgan/display` | | Display | The CPU/GPU/power dashboard on the Thermaltake 3.9" LCD | `kurgan/display` |
| Cooling | Commander PRO case fans and motherboard top fans on selectable profiles | `kurgan/cooling` | | Cooling | Commander PRO case fans and motherboard top fans on selectable profiles | `kurgan/cooling`, run by `kurgan/hw` |
| Lighting | Case fan, RAM and GPU LEDs: off, temperature or the red side chase | `kurgan/lighting` | | Lighting | Case fan, RAM and GPU LEDs: off, temperature or the red side chase | `kurgan/lighting` |
| AI | Serves Strata and llama.cpp at `/strata/v1` and `/llama/v1`, running **one** at a time: a request starts the one it needs, and an unused one stops | `kurgan/ai` | | AI | Serves Strata and llama.cpp at `/strata/v1` and `/llama/v1`, running **one** at a time: a request starts the one it needs, and an unused one stops | `kurgan/ai` |
| Web UI | Control and monitoring for all of the above, plus a JSON API | `kurgan/web` | | Web UI | Control and monitoring for all of the above, plus a JSON API | `kurgan/web` |
It replaces three background programs: the TT LCD Dashboard task, Strata's tray service and It replaces three background programs: the TT LCD Dashboard task, Strata's tray service and
the Qwen4 service (llama.cpp plus its monitor page on port 8084). Sensors are read once and the Qwen4 service (llama.cpp plus its monitor page on port 8084).
shared, so the LCD, the fan curves, the lighting and the web UI all use the same readings.
## How it's split
Two processes, so that only the part that needs admin rights has them:
- **The hardware service**, "The Kurgan hardware" (`KurganHw`, `kurgan/hw`): a Windows service
running as LocalSystem from boot, before anyone logs on. It does what needs PawnIO, plus what
must never depend on anything else: the case and top fan curves with their fail-safes, the
CPU package temperature and power, the GPU temperature it needs for the curves, and the RAM
lighting. It listens on no network port; its only interface is the named pipe
`\\.\pipe\kurgan-hw`. If it crashes, Windows restarts it after 5 s, 10 s, then 60 s.
- **The app**, "The Kurgan" (`python -m kurgan`): everything else, without admin rights, from a
logon task: the web UI, the AI servers (as its own children), telemetry, the LCD, the case fan
and GPU lighting, and the tray icon. It shows what the hardware service reports and asks it
for profile and RAM lighting changes. While the service is unavailable the app says so (UI,
tray balloon) and carries on without those readings.
Restarting or killing the app never touches the fans. Sensors the app reads itself are read
once and shared, so the LCD, the lighting and the web UI all use the same readings.
## Setup ## Setup
@@ -23,11 +41,20 @@ shared, so the LCD, the fan curves, the lighting and the web UI all use the same
powershell -ExecutionPolicy Bypass -File .\setup.ps1 -RetireAIServices powershell -ExecutionPolicy Bypass -File .\setup.ps1 -RetireAIServices
``` ```
This does the following: Run it from a normal (not elevated) PowerShell window; it asks for admin rights itself. It:
- Installs the Python packages into the project's `.venv` (or for the current user). - Installs the Python packages into the project's `.venv` (creating it if needed; the hardware service runs from it too).
- Installs [PawnIO](https://pawnio.eu). PawnIO is the signed driver LibreHardwareMonitor and FanControl also use. It reads the Intel CPU sensors and drives the motherboard fan headers and the RAM lighting. - Installs [PawnIO](https://pawnio.eu). PawnIO is the signed driver LibreHardwareMonitor and FanControl also use. It reads the Intel CPU sensors and drives the motherboard fan headers and the RAM lighting.
- Replaces the old **TT LCD Dashboard** task (and an older, elevated **The Kurgan** task) with a **The Kurgan** scheduled task, registered as you. The task runs `pythonw -m kurgan` hidden, without admin rights, at every logon. Run `setup.ps1` from a normal PowerShell window; it asks for admin rights itself. - Installs or updates the **The Kurgan hardware** service (`KurganHw`): LocalSystem, automatic start, restart on failure. It runs the base Python interpreter (not the venv's `python.exe`, a redirector) on `hw_service.py`, after checking that it can.
- Creates `%ProgramData%\Kurgan` (Administrators and SYSTEM write, users read) and, once, moves the fan settings and the RAM lighting mode from your `settings.json` into `hw-settings.json` there. `settings.json` keeps a dated `.bak` copy from before.
- Replaces the old **TT LCD Dashboard** task (and an older, elevated **The Kurgan** task) with a **The Kurgan** scheduled task, registered as you. The task runs `pythonw -m kurgan` hidden, without admin rights, at every logon.
- Prints what the hardware service reports (`python -m kurgan.hw.client` does that any time).
Run `setup.ps1` again after updating The Kurgan: it stops, updates and restarts both parts.
**Updating from the elevated version:** run `setup.ps1` before restarting the old elevated
"The Kurgan" task with this code. Until then there's no hardware service: the new app would
have no fan control to show, and (being elevated) it refuses to start the AI servers.
`-RetireAIServices` stops and disables the **Strata Local Service** and **Qwen4 Local Service** `-RetireAIServices` stops and disables the **Strata Local Service** and **Qwen4 Local Service**
tasks, so The Kurgan can run whichever server you select. Without that switch, The Kurgan finds tasks, so The Kurgan can run whichever server you select. Without that switch, The Kurgan finds
@@ -35,20 +62,31 @@ those servers already listening on their ports. It shows them as "running outsid
and monitors them, but it never starts a second copy. Requests go to one only once it answers and monitors them, but it never starts a second copy. Requests go to one only once it answers
as the expected server; a port held by some other program is reported, not served. as the expected server; a port held by some other program is reported, not served.
`uninstall.ps1` removes the task. `uninstall.ps1 -RestoreAIServices` also re-enables and starts `uninstall.ps1` removes the task and the hardware service (stopping it leaves the case fans at
the two LLM service tasks. `-RemovePawnIO` uninstalls PawnIO. 100% and the top fans on the BIOS curve). `uninstall.ps1 -RestoreAIServices` also re-enables and
starts the two LLM service tasks. `-RemovePawnIO` uninstalls PawnIO. Settings stay in
`%LOCALAPPDATA%\Kurgan` and `%ProgramData%\Kurgan`.
Admin rights are needed for these readings and controls: ### Security model
- CPU temperature and power - **Only the hardware service has admin rights**, and it has no network interface. Its pipe
- The motherboard top fans allows SYSTEM, Administrators and the user who ran `setup.ps1` (read and write, but not
- The RAM lighting creating pipe instances, so nothing running as you can impersonate the service's end), and
refuses remote clients. It accepts five operations (`hello`, `state`, `set_profile`,
Without admin rights those show `--` or stay idle, and everything else works. The LLM servers `set_ram_lighting`, `ram_chase`), checked strictly, in messages of at most 64 KiB; a client
are ordinary child processes of The Kurgan, each in a job object, at medium integrity: The silent for 30 s is dropped, and no client can hold up the fan loop. The app checks that the
Kurgan itself runs without admin rights, and if it is ever started elevated it refuses to start pipe belongs to SYSTEM or Administrators before using it.
them rather than pass admin rights on (see `kurgan/ai/launcher.py`). The web UI shows each - **The app runs without admin rights**: the web UI (127.0.0.1 only), the proxy, and the LLM
server's integrity level. servers, which are its own children in job objects at medium integrity. If the app is ever
started elevated it refuses to start them rather than pass admin rights on (see
`kurgan/ai/launcher.py`); the UI then warns "Running elevated", and shows each server's
integrity level. Anything running as you can use the web API, and through it (or the pipe)
change the fan profile and the RAM lighting, nothing more.
- **Not a boundary against malware running as you.** The service runs code from this repo and
the Python install in your profile, both of which you (and so anything running as you) can
change; the change would run as SYSTEM at the service's next start. That is the trust the
old elevated logon task had, at a higher level. A real boundary would need the service's code
and interpreter in an admin-only folder; that's not done.
## Web UI ## Web UI
@@ -56,18 +94,21 @@ Open it from the tray icon (left-click, or **Open The Kurgan** in its menu) or b
<http://127.0.0.1:8080/>. It only listens on 127.0.0.1. The page refreshes once a second while it <http://127.0.0.1:8080/>. It only listens on 127.0.0.1. The page refreshes once a second while it
is visible. Every chart has a **Table** button that shows the same numbers as a table. The tray is visible. Every chart has a **Table** button that shows the same numbers as a table. The tray
icon also pops a balloon tip when something starts to go wrong — a fan group entering failsafe, icon also pops a balloon tip when something starts to go wrong — a fan group entering failsafe,
an AI server reporting an error, or a sensor source starting to fail. Problems that start together an AI server reporting an error, a sensor source starting to fail, or the hardware service
becoming unavailable. Problems that start together
share one balloon (Windows shows one at a time), and a problem that clears and comes back share one balloon (Windows shows one at a time), and a problem that clears and comes back
balloons again only after 10 minutes. What is already wrong when The Kurgan starts is not balloons again only after 10 minutes. What is already wrong when The Kurgan starts is not
ballooned; it sits in the tray menu and the UI. ballooned; it sits in the tray menu and the UI. The header shows whether the hardware service
is reachable (hover for its version and uptime, or why not).
- **System**: CPU and GPU temperature, load, clock and power; GPU memory; the LCD's state. Charts show whole-PC power (stacked: other, CPU, GPU) and temperatures over the last 10 minutes. A range selector above the charts switches them to hourly averages for 24 hours, 7 days, 30 days or a year. Those long-term rollups live in `%LOCALAPPDATA%\Kurgan\records-YYYY-MM.jsonl` — one JSON line per hour with min, average and max per metric (the average only over the samples that had the metric), about 400 days kept. The hour in progress is checkpointed to `records-current.json` every minute and on exit and resumed at the next start, so a restart — even `schtasks /End` — loses at most a minute. Writing is best effort: a failing disk is logged at most once an hour, and finished hours wait in memory (up to two days) until it works again. `--demo` never records. When a sensor source is failing — its read raised, or it has returned no temperature three times in a row (a lost GPU driver, an unavailable MSR reader) — a pill in the header names it and hover shows the error. - **System**: CPU and GPU temperature, load, clock and power; GPU memory; the LCD's state. Charts show whole-PC power (stacked: other, CPU, GPU) and temperatures over the last 10 minutes. A range selector above the charts switches them to hourly averages for 24 hours, 7 days, 30 days or a year. Those long-term rollups live in `%LOCALAPPDATA%\Kurgan\records-YYYY-MM.jsonl` — one JSON line per hour with min, average and max per metric (the average only over the samples that had the metric), about 400 days kept. The hour in progress is checkpointed to `records-current.json` every minute and on exit and resumed at the next start, so a restart — even `schtasks /End` — loses at most a minute. Writing is best effort: a failing disk is logged at most once an hour, and finished hours wait in memory (up to two days) until it works again. `--demo` never records. When a sensor source is failing — its read raised, or it has returned no temperature three times in a row (a lost GPU driver, an unavailable MSR reader) — a pill in the header names it and hover shows the error.
- **Cooling**: the fan profile selector; each fan group's duty, temperature and RPMs; fan speeds over time; and the selected profile's curves, with a dot for each group's current operating point. Hover over a profile to preview its curves. - **Cooling**: the fan profile selector; each fan group's duty, temperature and RPMs; fan speeds over time; and the selected profile's curves, with a dot for each group's current operating point. Hover over a profile to preview its curves. All of it comes from the hardware service, and a profile change goes to it.
- **Lighting**: a mode selector per zone (case fans, RAM, GPU), the zone's status, and the shared chase speed. - **Lighting**: a mode selector per zone (case fans, RAM, GPU), the zone's status, and the shared chase speed.
- **AI**: pick Strata (and its model), llama.cpp or None; requests to either address also pick it. Then see the server's process, model, context size, live request progress and token speeds, and when it will stop if unused; load or unload the model; GPU memory over time; and recent requests. - **AI**: pick Strata (and its model), llama.cpp or None; requests to either address also pick it. Then see the server's process, model, context size, live request progress and token speeds, and when it will stop if unused; load or unload the model; GPU memory over time; and recent requests.
Every choice is saved immediately in `%LOCALAPPDATA%\Kurgan\settings.json` and restored at the Every choice is saved immediately and restored at the next start: the fan profile and the RAM
next start. lighting by the hardware service in `%ProgramData%\Kurgan\hw-settings.json`, the rest in
`%LOCALAPPDATA%\Kurgan\settings.json`.
### JSON API ### JSON API
@@ -87,6 +128,8 @@ POSTs to `/api/...` need `Content-Type: application/json` and an `X-Kurgan: 1` h
site can't send that header without a CORS preflight, which this server never answers. Requests site can't send that header without a CORS preflight, which this server never answers. Requests
must also name `127.0.0.1:<port>` or `localhost:<port>` as the Host, which blocks DNS rebinding. must also name `127.0.0.1:<port>` or `localhost:<port>` as the Host, which blocks DNS rebinding.
There is no other authentication: any program already running on this PC as you can use the API. There is no other authentication: any program already running on this PC as you can use the API.
`POST /api/cooling/profile`, and `/api/lighting` for the RAM, answer **503** while the hardware
service can't be reached (or can't save the change).
```powershell ```powershell
curl.exe -s -X POST -H "Content-Type: application/json" -H "X-Kurgan: 1" ` curl.exe -s -X POST -H "Content-Type: application/json" -H "X-Kurgan: 1" `
@@ -95,22 +138,35 @@ curl.exe -s -X POST -H "Content-Type: application/json" -H "X-Kurgan: 1" `
## Settings ## Settings
`%LOCALAPPDATA%\Kurgan\settings.json`, created on the first start: The app's: `%LOCALAPPDATA%\Kurgan\settings.json`, created on the first start:
```json ```json
{ {
"cooling": {"profile": "balanced", "gpu_ports": [4, 5, 6], "cpu_ports": [1, 2, 3], "top_channels": [2, 5]}, "lighting": {"case_fans": "chase", "gpu": "off"},
"lighting": {"case_fans": "chase", "memory": "off", "gpu": "off"},
"ai": {"active": "strata", "strata_model": "q5", "idle_stop_minutes": 40}, "ai": {"active": "strata", "strata_model": "q5", "idle_stop_minutes": 40},
"web": {"port": 8080} "web": {"port": 8080}
} }
``` ```
On the first start, The Kurgan imports the TT LCD Dashboard's fan ports and RAM and GPU lighting The hardware service's: `%ProgramData%\Kurgan\hw-settings.json` (admins write, users read):
modes from `%LOCALAPPDATA%\TTLcdDashboard`. The old task's `--rgb-side-chase` becomes
`case_fans: chase`. The file is checked strictly. An invalid file stops The Kurgan with a message, ```json
rather than starting without fan control. A failed save leaves the previous setting in place, {
both in memory and on disk. "cooling": {"profile": "balanced", "gpu_ports": [4, 5, 6], "cpu_ports": [1, 2, 3], "top_channels": [2, 5]},
"lighting": {"memory": "off"}
}
```
Both files are checked strictly, and a failed save leaves the previous setting in place, both in
memory and on disk. An invalid `settings.json` stops the app with a message. An invalid
`hw-settings.json` doesn't stop the service: it holds every case fan at 100% and says why in the
UI's cooling section; fix the file and `Restart-Service KurganHw` (elevated). A `settings.json`
from before the split may still hold `cooling` and `lighting.memory`: they're checked and kept,
but nothing uses them (`setup.ps1` moves them).
On the first start, The Kurgan imports the TT LCD Dashboard's settings from
`%LOCALAPPDATA%\TTLcdDashboard` into `settings.json` (`setup.ps1` then moves the fan and RAM
parts). The old task's `--rgb-side-chase` becomes `case_fans: chase`.
`idle_stop_minutes` is how long a server may go unused before The Kurgan stops it (0 = never, `idle_stop_minutes` is how long a server may go unused before The Kurgan stops it (0 = never,
up to 1440). The `ai` section also accepts these optional keys, for when an install moves: up to 1440). The `ai` section also accepts these optional keys, for when an install moves:
@@ -121,9 +177,12 @@ up to 1440). The `ai` section also accepts these optional keys, for when an inst
See `kurgan/ai/config.py`. Restart The Kurgan after editing the file by hand. See `kurgan/ai/config.py`. Restart The Kurgan after editing the file by hand.
Command-line lighting options such as `--rgb-side-chase` apply to that run only. The UI marks Command-line lighting options such as `--rgb-side-chase` apply to that run only. The UI marks
them "this run only"; choosing a mode in the UI saves it. them "this run only"; choosing a mode in the UI saves it. The RAM has none: it's the hardware
service's, and only the UI changes it.
Log: `%LOCALAPPDATA%\Kurgan\kurgan.log` Logs: `%LOCALAPPDATA%\Kurgan\kurgan.log` (the app), `%ProgramData%\Kurgan\kurgan-hw.log` (the
hardware service; it logs each change of a fan group's status, which carries its temperature,
duty and speeds, so it shows fan control running even before logon).
## AI: Strata and llama.cpp ## AI: Strata and llama.cpp
@@ -237,10 +296,11 @@ On this machine, identification confirmed these mappings:
- The two top extractors are on **SYS_FAN1 and SYS_FAN4** (NCT6687D PWM channels 2 and 5). - The two top extractors are on **SYS_FAN1 and SYS_FAN4** (NCT6687D PWM channels 2 and 5).
- The CPU cooler is on CPU_FAN1 (channel 0), which is never touched. - The CPU cooler is on CPU_FAN1 (channel 0), which is never touched.
The mapping is in `settings.json`. To identify or change it, first exit The Kurgan from its The mapping is in `hw-settings.json`. To identify or change it, from an elevated PowerShell,
tray menu, then run: stop the hardware service (the case fans go to 100%), run the tools, then start it again:
```powershell ```powershell
Stop-Service KurganHw
.\.venv\Scripts\python.exe -m kurgan.cooling.control --identify 1,2,3 # these ports to 100%; watch which side speeds up .\.venv\Scripts\python.exe -m kurgan.cooling.control --identify 1,2,3 # these ports to 100%; watch which side speeds up
.\.venv\Scripts\python.exe -m kurgan.cooling.control --save-ports 4,5,6 # GPU side .\.venv\Scripts\python.exe -m kurgan.cooling.control --save-ports 4,5,6 # GPU side
.\.venv\Scripts\python.exe -m kurgan.cooling.control --save-cpu-ports 1,2,3 # CPU side (GPU side first) .\.venv\Scripts\python.exe -m kurgan.cooling.control --save-cpu-ports 1,2,3 # CPU side (GPU side first)
@@ -248,6 +308,7 @@ tray menu, then run:
.\.venv\Scripts\python.exe -m kurgan.cooling.board_fans --identify 2,5 # hold channels at 100% (admin) .\.venv\Scripts\python.exe -m kurgan.cooling.board_fans --identify 2,5 # hold channels at 100% (admin)
.\.venv\Scripts\python.exe -m kurgan.cooling.board_fans --auto 2,5 # hand them back to the BIOS (admin) .\.venv\Scripts\python.exe -m kurgan.cooling.board_fans --auto 2,5 # hand them back to the BIOS (admin)
.\.venv\Scripts\python.exe -m kurgan.cooling.control --save-top-channels 2,5 .\.venv\Scripts\python.exe -m kurgan.cooling.control --save-top-channels 2,5
Start-Service KurganHw
``` ```
`--identify` leaves the selected group at 100%, rather than guessing its previous profile. Do not `--identify` leaves the selected group at 100%, rather than guessing its previous profile. Do not
@@ -259,11 +320,12 @@ disable its **Corsair Commander Pro** and **Corsair Lighting Node Core** detecto
`%APPDATA%\OpenRGB\OpenRGB.json` and `C:\Program Files\OpenRGB\service_config\OpenRGB.json`. While `%APPDATA%\OpenRGB\OpenRGB.json` and `C:\Program Files\OpenRGB\service_config\OpenRGB.json`. While
another tool has a device, The Kurgan leaves that device alone and says so in the UI. The top fans another tool has a device, The Kurgan leaves that device alone and says so in the UI. The top fans
share LibreHardwareMonitor's ISA-bus mutex, so don't let another tool control the same headers. share LibreHardwareMonitor's ISA-bus mutex, so don't let another tool control the same headers.
On exit the case fans are left at 100% and the top fans go back to the BIOS Smart Fan curve. When the hardware service stops (including at shutdown), the case fans are left at 100% and the
top fans go back to the BIOS Smart Fan curve.
This is software control, not a hardware thermal safeguard. It can't guarantee a speed change This is software control, not a hardware thermal safeguard. It can't guarantee a speed change
after a USB failure, a forced process kill or a system hang, and the Commander PRO may keep its after a USB failure, a forced kill of the hardware service or a system hang, and the Commander
last duty. If a top-fan write fails, The Kurgan hands those headers back to the BIOS curve at PRO keeps its last duty until the service is back (Windows restarts it within seconds). If a top-fan write fails, The Kurgan hands those headers back to the BIOS curve at
once; if even that fails, the UI says what duty they are left at. Verify temperatures and fan once; if even that fails, the UI says what duty they are left at. Verify temperatures and fan
rotation under your real workloads. Only SYS_FAN4's tach is wired to the EC, so top-fan stall rotation under your real workloads. Only SYS_FAN4's tach is wired to the EC, so top-fan stall
detection covers that fan only: a channel whose tach has never been seen turning is left alone detection covers that fan only: a channel whose tach has never been seen turning is left alone
@@ -276,14 +338,14 @@ fans carry on; if the case fans' control loop itself hits an unexpected error, a
| Zone | Device | Modes | | Zone | Device | Modes |
| --- | --- | --- | | --- | --- | --- |
| Case fans | Corsair Lighting Node CORE (`1B1C:0C1A`), six QL120 fans on header 1 | off, temperature, red side chase | | Case fans | Corsair Lighting Node CORE (`1B1C:0C1A`), six QL120 fans on header 1 | off, temperature, red side chase |
| RAM | Four Corsair Dominator Platinum DDR5 sticks, over the Intel SMBus through PawnIO (admin) | off, temperature, red side chase | | RAM | Four Corsair Dominator Platinum DDR5 sticks, over the Intel SMBus through PawnIO (driven by the hardware service) | off, temperature, red side chase |
| GPU | ASUS ROG STRIX RTX 4090 LED row, over NVIDIA's `nvapi64.dll` | off, red side chase | | GPU | ASUS ROG STRIX RTX 4090 LED row, over NVIDIA's `nvapi64.dll` | off, red side chase |
- **Off**: the case fans return to the CORE's own hardware effect. The RAM is held dark while The Kurgan runs; black frames are refreshed every 5 s, and the stored effects are untouched. The GPU's previous direct colours and mode are restored. - **Off**: the case fans return to the CORE's own hardware effect. The RAM is held dark while The Kurgan runs; black frames are refreshed every 5 s, and the stored effects are untouched. The GPU's previous direct colours and mode are restored.
- **Temperature**: - **Temperature**:
- Case fans: the CPU-side fans follow CPU temperature and the GPU-side fans follow GPU temperature. They are green below `--temp-warn` (50 C), yellow up to `--temp-hot` (80 C), and red above. - Case fans: the CPU-side fans follow CPU temperature and the GPU-side fans follow GPU temperature. They are green below `--temp-warn` (50 C), yellow up to `--temp-hot` (80 C), and red above.
- RAM: the hotter of CPU and GPU blends from dark red `(24, 0, 0)` to warm orange `(255, 48, 0)`. - RAM: the hotter of CPU and GPU blends from dark red `(24, 0, 0)` to warm orange `(255, 48, 0)`, between 50 C and 80 C (the hardware service's fixed range; `--temp-warn` and `--temp-hot` don't reach it).
- **Red side chase**: warm-orange heads with four fading trail LEDs over dark red. All three zones share one power-paced clock, so they stay in step. The pace is 150 ms per LED at 150 W or less, speeding up evenly to 25 ms at 550 W or more (`--rgb-chase-*`). - **Red side chase**: warm-orange heads with four fading trail LEDs over dark red. All three zones share one power-paced clock, so they stay in step: the app sends it to the hardware service for the RAM once a second. The pace is 150 ms per LED at 150 W or less, speeding up evenly to 25 ms at 550 W or more (`--rgb-chase-*`).
- Case fans: the CPU route is bottom → middle → top → middle, and the GPU side is mirrored. - Case fans: the CPU route is bottom → middle → top → middle, and the GPU side is mirrored.
- RAM: two mirrored heads visit sticks 4 → 3 → 2 → 1 → 2 → 3 once per fan cycle. - RAM: two mirrored heads visit sticks 4 → 3 → 2 → 1 → 2 → 3 once per fan cycle.
- GPU: one head runs front to back and back again once per cycle. - GPU: one head runs front to back and back again once per cycle.
@@ -301,11 +363,13 @@ Calibrated case-fan outer-ring indices (zero-based within each 34-LED fan: hub 0
| 6 | CPU middle | 19 / 20 | | 6 | CPU middle | 19 / 20 |
The CORE needs a keep-alive every 5 seconds or it drops back to its hardware effect. Updates on The CORE needs a keep-alive every 5 seconds or it drops back to its hardware effect. Updates on
every device are capped at about 22 per second. The CORE and the LCD share a Genesys USB 2.0 hub, every device are capped at about 22 per second. The CORE and the LCD used to share a Genesys
and heavier traffic once hung the LCD firmware until it was power-cycled. If the LCD repeatedly USB 2.0 hub, and heavier traffic once hung the LCD firmware until it was power-cycled. The LCD is
reports a handshake timeout (opcode `0x85`), set the case fans to off. Then safely power-cycle now on a back-panel port, directly on the Intel root hub; the CORE shares the Genesys hub
the LCD and check the cable, power and hub routing before re-enabling the chase. Do not unplug (`05E3:0610`, then `05E3:0608`) with the Commander PRO, which sends little. The cap stays as a
internal cables while the PC is powered. margin. If the LCD repeatedly reports a handshake timeout (opcode `0x85`), set the case fans to
off. Then safely power-cycle the LCD and check the cable, power and hub routing before
re-enabling the chase. Do not unplug internal cables while the PC is powered.
The RAM controllers are at `0x18`-`0x1B`, top to bottom. They are written directly over SMBus The RAM controllers are at `0x18`-`0x1B`, top to bottom. They are written directly over SMBus
with PawnIO's I801 module (PawnIO Modules 0.2.12; its LGPL source and licence are in with PawnIO's I801 module (PawnIO Modules 0.2.12; its LGPL source and licence are in
@@ -344,12 +408,12 @@ All figures are DC watts, i.e. load on the power supply; wall draw is roughly 8
| Part | Source | | Part | Source |
| --- | --- | | --- | --- |
| CPU | Measured: the package's energy counter (RAPL), via PawnIO | | CPU | Measured: the package's energy counter (RAPL), via PawnIO, read by the hardware service |
| GPU | Measured: board power from NVIDIA (the whole card, including its fans and lighting) | | GPU | Measured: board power from NVIDIA (the whole card, including its fans and lighting) |
| CPU regulator losses | Derived: CPU watts × 11% | | CPU regulator losses | Derived: CPU watts × 11% |
| Memory | Estimated per module (4 × DDR5): 2.5 W idle to 5.5 W, scaled by CPU load | | Memory | Estimated per module (4 × DDR5): 2.5 W idle to 5.5 W, scaled by CPU load |
| Drives | Estimated from each drive's activity and rated power (Lexar NQ790 3.5 W, Kingston KC3000 8.8 W; the USB hard drive as bus-powered, spun down after 10 minutes idle) | | Drives | Estimated from each drive's activity and rated power (Lexar NQ790 3.5 W, Kingston KC3000 8.8 W; the USB hard drive as bus-powered, spun down after 10 minutes idle) |
| Case fans | Estimated from the Commander PRO's fan speeds (about 2 W per fan at 1500 rpm) | | Case fans | Estimated from the Commander PRO's fan speeds, read by the hardware service (about 2 W per fan at 1500 rpm) |
| Motherboard & chipset | Fixed 15 W | | Motherboard & chipset | Fixed 15 W |
| Motherboard-header fans/pump | Fixed 5 W | | Motherboard-header fans/pump | Fixed 5 W |
| USB devices & RGB lighting | Fixed 12 W | | USB devices & RGB lighting | Fixed 12 W |
@@ -358,6 +422,8 @@ The estimates are in `PowerModel` in `kurgan/telemetry/sensors.py`.
## Running by hand ## Running by hand
The app (no admin rights needed; the hardware service keeps running):
```powershell ```powershell
Stop-ScheduledTask "The Kurgan" # only one copy runs at a time Stop-ScheduledTask "The Kurgan" # only one copy runs at a time
.\.venv\Scripts\python.exe -m kurgan # console, Ctrl+C to stop .\.venv\Scripts\python.exe -m kurgan # console, Ctrl+C to stop
@@ -367,13 +433,25 @@ $env:KURGAN_DATA_DIR = "$env:TEMP\kurgan-demo"
Start-ScheduledTask "The Kurgan" # back to the hidden copy Start-ScheduledTask "The Kurgan" # back to the hidden copy
``` ```
In demo mode the LLM servers use ports 18082 and 18083, but they are real servers. The hardware service (elevated PowerShell for all but the first line):
```powershell
.\.venv\Scripts\python.exe -m kurgan.hw.client # is it reachable, and what is it doing?
Restart-Service KurganHw # e.g. after editing hw-settings.json
Stop-Service KurganHw # case fans to 100%, top fans to the BIOS
& (.\.venv\Scripts\python.exe -c "import sys; print(sys._base_executable)") -I -S -B .\hw_service.py -v # in a console instead
Start-Service KurganHw
```
In demo mode the hardware service runs inside the app on simulated devices, with its settings in
`demo-hw-settings.json` in the demo's data folder. The LLM servers use ports 18082 and 18083, but
they are real servers.
`python -m kurgan --help` lists the LCD and lighting options. To make one permanent, add it to the `python -m kurgan --help` lists the LCD and lighting options. To make one permanent, add it to the
task's arguments. Lighting modes are better chosen in the UI. task's arguments. Lighting modes are better chosen in the UI.
| Tool | Use | | Tool | Use |
| --- | --- | | --- | --- |
| `python -m kurgan.telemetry.sensors` | Print the live readings and power breakdown (exit The Kurgan first: one program at a time should poll the Commander PRO) | | `python -m kurgan.telemetry.sensors` | Print the live readings and power breakdown (elevated, with the hardware service stopped: one program at a time should poll the Commander PRO) |
| `python -m kurgan.display.renderer demo.png` | Render the LCD with fixed demo values | | `python -m kurgan.display.renderer demo.png` | Render the LCD with fixed demo values |
| `python -m kurgan.display.tt_lcd` | LCD test card | | `python -m kurgan.display.tt_lcd` | LCD test card |
| `python -m kurgan.tray` | Show a test tray icon for 20 seconds | | `python -m kurgan.tray` | Show a test tray icon for 20 seconds |
@@ -398,6 +476,11 @@ kurgan/
assets/ sword.png, hilt.png, kurgan.ico (tray icon); make_assets.py rebuilds them and the assets/ sword.png, hilt.png, kurgan.ico (tray icon); make_assets.py rebuilds them and the
web UI's logo and favicon from The-Kurgan-Sword.png web UI's logo and favicon from The-Kurgan-Sword.png
hardware/ hid.py (Windows HID), pawnio/ (signed PawnIO modules, LGPL-2.1) hardware/ hid.py (Windows HID), pawnio/ (signed PawnIO modules, LGPL-2.1)
hw/ the hardware service: protocol.py, pipe.py (access-controlled named pipe),
service.py (fan loop, RAM lighting, state), main.py, winservice.py (pywin32 host),
settings.py (hw-settings.json), install.py and migrate.py (setup.ps1),
client.py (the app's side)
hw_service.py the hardware service's entry point (what the service manager runs)
tests/ unittest suites tests/ unittest suites
docs/ design references and research notes docs/ design references and research notes
lcd_dashboard.py compatibility shim for the old "TT LCD Dashboard" task until setup.ps1 is re-run lcd_dashboard.py compatibility shim for the old "TT LCD Dashboard" task until setup.ps1 is re-run
+4 -2
View File
@@ -20,8 +20,10 @@ log = logging.getLogger(__name__)
_RETRY_SECONDS = 10.0 _RETRY_SECONDS = 10.0
_FAN_TOP_RIGHT = (17, 17, 17, 20, 11, 20) _FAN_TOP_RIGHT = (17, 17, 17, 20, 11, 20)
_CHASE_EASE_SECONDS = 1.0 _CHASE_EASE_SECONDS = 1.0
# The CORE shares a USB 2.0 hub with the LCD; flooding it hung the LCD firmware, so cap # The CORE used to share a USB 2.0 hub with the LCD, and flooding it hung the LCD firmware. The
# frames at ~22/s and let a fast chase advance more than one LED per frame instead. # LCD is now on a back-panel port, and the CORE shares its Genesys hub with the Commander PRO
# (light traffic); frames stay capped at ~22/s as a margin, a fast chase advancing more than one
# LED per frame instead.
MIN_CHASE_FRAME_SECONDS = 0.045 MIN_CHASE_FRAME_SECONDS = 0.045
CHASE_POLL_SECONDS = 0.02 CHASE_POLL_SECONDS = 0.02