From b8240e4fe737bd667847c7def03ea712b155060b Mon Sep 17 00:00:00 2001 From: "v.degtev" Date: Sun, 18 Oct 2026 12:54:47 +0300 Subject: [PATCH 01/24] docs: define Windows Kiyo Pro support design --- docs/superpowers/kiyo-pro-progress.md | 25 +++ .../specs/2026-10-18-kiyo-pro-design.md | 168 ++++++++++++++++++ 2 files changed, 193 insertions(+) create mode 100644 docs/superpowers/kiyo-pro-progress.md create mode 100644 docs/superpowers/specs/2026-10-18-kiyo-pro-design.md diff --git a/docs/superpowers/kiyo-pro-progress.md b/docs/superpowers/kiyo-pro-progress.md new file mode 100644 index 0000000..d746339 --- /dev/null +++ b/docs/superpowers/kiyo-pro-progress.md @@ -0,0 +1,25 @@ +# Kiyo Pro support + +Goal: support the Razer Kiyo Pro RZ1900364 on Windows 10/11 in the existing +Secretarybird Rust core, CLI, and tray/editor, suitable for an upstream PR. + +- [x] Inspect fork and upstream discovery, transport, and tray integration. +- [x] Confirm Windows target and upstream architecture requirement. +- [x] Agree on approach and feature scope in chat. +- [x] Write and self-review architectural design specification. +- [ ] Obtain user approval of the written specification. +- [ ] Write implementation plan and agree on execution method. +- [ ] Implement with regression tests. +- [ ] Verify builds/tests and document required Windows hardware checks. + +Findings: discovery currently enumerates HID interfaces and requires a successful +Protocol 2.5 serial query. Kiyo Pro uses UVC camera controls (USB 1532:0E05), +including vendor extension-unit commands for HDR, field of view, and autofocus +mode. A database-only addition cannot provide camera support. The HID Transport +trait explicitly models feature reports; camera commands must not be disguised +as HID reports. + +No product code has been changed. + +Design: `specs/2026-10-18-kiyo-pro-design.md`. Firmware work is explicitly +excluded at the user's request. Awaiting review of the written specification. diff --git a/docs/superpowers/specs/2026-10-18-kiyo-pro-design.md b/docs/superpowers/specs/2026-10-18-kiyo-pro-design.md new file mode 100644 index 0000000..d72300f --- /dev/null +++ b/docs/superpowers/specs/2026-10-18-kiyo-pro-design.md @@ -0,0 +1,168 @@ +# Razer Kiyo Pro support on Windows + +## Goal and scope + +Support the Razer Kiyo Pro RZ1900364 (USB VID:PID `1532:0E05`) on Windows +10/11 through Secretarybird's existing Rust core, CLI, and tray/editor. +The change should be reviewable as an upstream PR, without replacing the HID +backend, adding a background service, installing a driver, or requiring Synapse. + +The first version supports discovery, HDR on/off, HDR dark/bright mode, +wide/medium/narrow field of view, responsive/passive autofocus mode, and saved +profiles. Autofocus mode is the vendor's focusing strategy, not a manual-focus +slider or an autofocus enable switch. + +Out of scope: firmware checking or flashing, video preview/capture, resolution +and frame-rate selection, generic UVC image controls, other webcam models, +Linux/macOS camera implementations, and a general rewrite of device transport. +Existing non-Windows functionality must continue to build and work unchanged. + +## Findings + +Both the fork and upstream discover only Razer HID interfaces. Opening a device +requires a successful Protocol 2.5 serial query. The `Transport` trait represents +HID feature reports explicitly. Kiyo Pro uses UVC, including vendor extension-unit +controls, so neither a database-only entry nor a new HID transaction ID addresses +the recognition failure. + +Public references: + +- https://github.com/soyersoyer/kiyoproctrls +- https://github.com/openrazer/openrazer/issues/1665 + +Protocol facts will be independently encoded; implementation must respect the +reference project's license rather than copying its source into this project. + +## Approach and alternatives + +Add a camera-specific module to `secbird-core` alongside existing device support. +Retain the existing HID `Device`, `Transport`, and discovery API. Add explicit +camera discovery and operations, consumed by the current CLI and tray engine. +Use a small metadata view where consumers need common identity/labels; do not +force camera operations through HID commands or fabricate HID replies. + +A broad generic-device/transport refactor would touch unrelated capabilities and +make upstream review harder. A standalone camera service would duplicate device +and profile ownership and violate the intended lightweight architecture. Neither +is part of this design. + +## Windows backend + +Use Windows' built-in camera driver through DirectShow enumeration and kernel +streaming extension-unit properties. Enumerate video capture devices, match the +USB vendor/product IDs from their device identity, and locate the extension unit +by GUID `23e49ed0-1178-4f31-ae52-d2fb8a8d3b48`, not a hard-coded node number. + +Discover the node through camera topology, then use its node-specific KS control +interface for property requests. Check required properties and payload sizes +before writes. Bind only the capture device needed for controls; never start a +video stream merely to discover or configure a camera. + +Keep COM objects on a dedicated, COM-initialized worker thread owned by the camera +backend. CLI and tray use request/reply messages with plain Rust values; raw COM +interfaces never cross threads or acquire unsafe `Send` implementations. Release +objects and uninitialize COM on their owning thread during shutdown. + +Windows bindings are target-specific dependencies. The protocol encoding and +settings types stay platform-neutral and testable without Windows or hardware. +On other platforms the CLI explains that camera control is Windows-only. + +## Identity and discovery + +Add a webcam device kind and a Kiyo Pro database entry, without lighting, DPI, +polling, or button capabilities. Cameras appear in the existing connected-device +lists with camera-specific capabilities, not as failed Protocol 2.5 devices. + +Use a namespaced camera identity derived from the Windows capture-device path. +Never merge two identical cameras merely because their product IDs match. Keep +the display label separate from the persistent identity. A path-based identity +may change when USB ports change; document this rather than claiming serial-based +identity when no usable serial is available. + +Discovery is read-only: it must not change HDR, field of view, focus strategy, or +on-device persistent memory. A recognized camera whose controls cannot be opened +should remain visible with an actionable error, rather than silently disappearing. +Exclude any matching camera HID sibling from peripheral protocol probing when its +database classification identifies it as a webcam. + +## Protocol and control operations + +Use typed values for HDR, HDR mode, field of view, and autofocus strategy. The +camera module independently encodes the documented eight-byte command payloads. +The vendor extension selector for ISP writes is `1`. + +Medium and narrow field-of-view changes require an ordered preparation command +followed by the selected command. Execute each setting sequence without +interleaving requests from another caller. Abort the sequence on the first failed +write and return the affected setting and Windows error. + +The reference also documents an on-device save command. Do not send it +automatically: Secretarybird already owns saved profiles, and routine edits or +startup should not silently cause persistent camera writes. + +Do not assume current settings can be read reliably. Distinguish desired/saved +values and successfully sent values from hardware-confirmed values. Initial +camera settings are unset, so adding a camera cannot overwrite its existing +configuration with invented defaults. Do not send the reference's unexplained +startup command. + +## Existing application integration + +### CLI and diagnostics + +Include cameras in `secbird list` and read-only device reports. Extend existing +device selection to resolve a camera identity or an unambiguous product ID; +multiple matching cameras require explicit selection. + +Add a `camera` command with typed subcommands for `hdr`, `hdr-mode`, `fov`, and +`af-mode`. Help text states the accepted values and Windows-only scope. Reject +camera commands for HID devices and peripheral commands for cameras before I/O. +Report success only when the corresponding write sequence succeeds. + +### Profiles + +Extend the existing profile schema with optional camera settings using serde +defaults so older files still load. Reuse the existing profile file and profile +selection semantics, not a second settings store. Apply only explicitly stored +camera values on profile activation, startup, reconnect, and wake. Retain errors +per setting through the existing apply-report mechanism. + +### Tray/editor + +Extend the existing engine's enumeration, selection, and rescan paths to include +cameras. Add a Camera section with the four supported controls; hide mouse, +keyboard, lighting, and other inapplicable sections. Reuse the existing local +HTTP server and its authentication, input validation, and profile persistence. + +Show values as saved/requested, not live readbacks. Surface camera-busy, +disconnected, inaccessible, and unsupported-extension errors. A disconnect must +invalidate stale camera handles; rescan reopens the currently connected device. +Profile replay must not prevent other devices from being applied if a camera +fails. No firmware features are added for cameras. + +## Verification and acceptance + +Write failing tests before production changes for protocol payloads, ordered +field-of-view sequences, early failure handling, input validation, identity and +selection, backwards-compatible profiles, and unset-settings/no-write behavior. +Use a fake camera control boundary rather than COM or physical hardware in unit +tests. Cover editor/API rejection of settings that do not apply to the device. + +Run existing regression tests, formatting, and appropriate lint checks. Compile +the Windows core, CLI, and tray paths; keep Linux core/CLI checks green. Verify +the existing HID simulator behavior is unaffected. Where the current macOS +environment cannot execute Windows checks, document the limitation and use +Windows CI rather than treating a non-Windows build as Windows verification. + +Before claiming hardware-verified support, test on Windows with a physical Kiyo +Pro and Synapse closed: + +1. Correct recognition, no duplicate entries, and read-only discovery/reporting. +2. Visible HDR and field-of-view changes, plus autofocus-mode command behavior. +3. Profile switching and restart/reconnect/wake reapplication. +4. Errors and recovery with the camera unplugged or in use by a video app. +5. No regressions for an existing HID device used alongside the camera. + +Record tested Windows and camera firmware versions in the PR. Until physical +checks pass, describe the feature as implemented but not hardware-verified. Do +not infer success from a saved UI value or from successful compilation. From fdab37d486ad293840a73387ac1a37cfa3affe23 Mon Sep 17 00:00:00 2001 From: "v.degtev" Date: Sun, 18 Oct 2026 13:03:12 +0300 Subject: [PATCH 02/24] docs: plan Kiyo Pro controls and browser preview --- docs/superpowers/kiyo-pro-progress.md | 12 +- docs/superpowers/plans/2026-10-18-kiyo-pro.md | 325 ++++++++++++++++++ .../specs/2026-10-18-kiyo-pro-design.md | 54 ++- 3 files changed, 386 insertions(+), 5 deletions(-) create mode 100644 docs/superpowers/plans/2026-10-18-kiyo-pro.md diff --git a/docs/superpowers/kiyo-pro-progress.md b/docs/superpowers/kiyo-pro-progress.md index d746339..a647353 100644 --- a/docs/superpowers/kiyo-pro-progress.md +++ b/docs/superpowers/kiyo-pro-progress.md @@ -7,7 +7,7 @@ Secretarybird Rust core, CLI, and tray/editor, suitable for an upstream PR. - [x] Confirm Windows target and upstream architecture requirement. - [x] Agree on approach and feature scope in chat. - [x] Write and self-review architectural design specification. -- [ ] Obtain user approval of the written specification. +- [x] Obtain user approval of the written specification. - [ ] Write implementation plan and agree on execution method. - [ ] Implement with regression tests. - [ ] Verify builds/tests and document required Windows hardware checks. @@ -23,3 +23,13 @@ No product code has been changed. Design: `specs/2026-10-18-kiyo-pro-design.md`. Firmware work is explicitly excluded at the user's request. Awaiting review of the written specification. + +Scope amendment: include opt-in editor video preview and resolution/FPS choices +for that preview session only. Photo capture/video recording remain excluded. +The specification includes camera-access conflicts, resource cleanup, and +preview-specific acceptance checks. + +User approved the amended specification. Implementation plan written and +self-reviewed at `plans/2026-10-18-kiyo-pro.md`; awaiting plan review and execution +method selection. Product code is unchanged. Preview implementation is planned +through browser-native capture inside the existing local editor. diff --git a/docs/superpowers/plans/2026-10-18-kiyo-pro.md b/docs/superpowers/plans/2026-10-18-kiyo-pro.md new file mode 100644 index 0000000..44471c6 --- /dev/null +++ b/docs/superpowers/plans/2026-10-18-kiyo-pro.md @@ -0,0 +1,325 @@ +# Kiyo Pro Windows Support Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking. + +**Goal:** Recognize and configure Kiyo Pro cameras on Windows through the existing CLI and tray/editor, including opt-in live preview and preview-only resolution/FPS selection. + +**Architecture:** Keep HID discovery, `Device`, and `Transport` intact. Add a separate camera API in `secbird-core`, backed by a COM-owning Windows worker, then integrate camera identities into the existing profile, CLI, and tray flows. Use browser-native `getUserMedia` to deliver preview frames directly to a `