Add device lock support and demo mode

Device lock (hardware lock of the DSP, independent of the app lock):
- detect a locked DSP from the 0x2C answer during connect and wait for the code
- unlock with 0x2D, optionally remember the code and unlock automatically
- set a new code (0x2F) from the device settings
- simulator: --lock CODE

Demo mode:
- switch in the settings starts a simulated DSP 204/408 inside the server
- real DSPs are disconnected and greyed out meanwhile and resume afterwards
- demo devices are never saved or exported; sim.py ships with the Pi image and EXEs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
GivouandClaude Opus 5.5 committed 2026-11-01 21:14:04 +01:00
1 parent fe13f261f7
commit 61400df667
13 files changed
+426 -38

No files matched your search

+12 -3
View File
@@ -33,7 +33,14 @@ pi_writer.py → pi_image.py (cloud-init SD card, installs server.py as a system
current view (`mixer`, `channel`, `routing`, `link`, `limiter`, `settings`). Live widgets register in `live` and are
updated without a full redraw. **All UI text goes through `t("English text", {vars})`**; German lives in
`static/i18n.js` (`DE`, plus `DE_PATTERNS` for server messages with variables, applied by `trMsg()`).
* **`sim.py`** – simulated DSP 204/408 speaking the same protocol (meters, limiter flags, links). Use it for all tests.
* **`sim.py`** – simulated DSP 204/408 speaking the same protocol (meters, limiter flags, links, lock code via
`--lock`). Use it for all tests. The server also imports it for the **demo mode** (`App.start_demo`: real
devices are stopped, a `SimDSP` runs on a random localhost port, a `Device` with `demo = True` connects to it;
demo devices are never saved, exported or editable). `sim.py` therefore ships with the Pi image and the EXEs.
* **Device lock** (hardware, unrelated to the app lock) – `Device._wait_for_unlock` holds the init after `0x2C`
reports a lock, tries the remembered code (`lock_code` + `auto_unlock` in `config.json`, clients only see a
boolean) or sets status `locked` and waits for `POST /api/devices/<id>/unlock {code, remember}`.
`POST …/lockcode {code}` sets a new code.
* **`desktop.py`** – starts `server.App` on 127.0.0.1 with a random port in a thread and opens a pywebview window.
`Api` exposes native file dialogs to the page (`window.pywebview.api.save_file/open_file`). Single instance via a
named mutex (Windows) or lock file (macOS). Data in `%APPDATA%\DSP Control` / `~/Library/Application Support/DSP Control`.
@@ -77,8 +84,10 @@ Not verified yet – ask for a log (`python server.py -v`) from real hardware be
* **DSP 408 on real hardware** (layout and frames match published captures, limiter bits for Out 5–8 assumed)
* USB on Windows and Linux against a real DSP (only tested against a fake HID device)
* Where the PEQ bypass flag lives in the memory image; format of the set-command acknowledgement; payload of the
preset-count answer (`0x2C`)
* Where the PEQ bypass flag lives in the memory image; format of the set-command acknowledgement; where the number
of preset slots comes from (20 is assumed when the `0x2C` answer carries the lock state)
* Device lock (`0x2C` byte 5, `0x2D`, `0x2F`, `0x11`) – implemented from the control software's behaviour and
tested against the simulator only; no command to remove a lock is known
* Limiter calculator reference level (assumes limiter 0 dB = 0 dBu at the output; adjustable per device)
* Pi Writer: raw write to a real SD card and first boot on a real Pi (only tested with an image file)