Skip to content

feat(gui): add guarded disable-keys controls - #993

Open
safonin wants to merge 7 commits into
AprilNEA:masterfrom
safonin:feat/keyboard-disable-keys-controls
Open

feat(gui): add guarded disable-keys controls#993
safonin wants to merge 7 commits into
AprilNEA:masterfrom
safonin:feat/keyboard-disable-keys-controls

Conversation

@safonin

@safonin safonin commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Add capability-aware Disable Keys controls for keyboards exposing HID++ feature 0x4521.

The controls show only keys advertised by the firmware, use live device state, and persist only state confirmed by the keyboard.

Changes

  • openlogi-core / openlogi-device
    • Add raw-preserving Disable Keys masks and state types.
    • Reject unknown or firmware-unsupported requested bits.
    • Preserve advertised unknown bits during replacement writes.
    • Confirm every write with a complete read-back comparison.
  • openlogi-agent-core / openlogi-agent / openlogi-ipc
    • Append protocol v29 Disable Keys read/write operations.
    • Route operations through the registry-current shared keyboard channel.
    • Reapply configured state after initial discovery, reconnect, and wake using the existing bounded confirmation retries.
    • Add strict mock-agent scenarios and real server routing coverage.
  • openlogi-desktop / openlogi-ui
    • Add a capability-gated Disabled keys card.
    • Render only firmware-supported keys.
    • Fence asynchronous reads, writes, selection changes, and reconnects against stale results.
    • Persist only confirmed supported known bits.
    • Keep hardware, save, and agent-reload failures recoverable.
    • Add strings to every locale catalog.

Hardware verification

Verified on a Logitech MX Keys connected directly over Bluetooth:

  • macOS 26.6 on Apple Silicon
  • USB model ID 046d:b35b
  • Logi Options+ removed and not running
  • Firmware support mask read as 0x1f
  • Initial disabled mask read as 0x00
  • Disabling Caps Lock wrote and read back 0x01
  • The macOS language-switch action assigned to Caps Lock stopped firing
  • Re-enabling Caps Lock restored 0x00 and the language switch worked again
  • A keyboard power cycle confirmed that configured 0x01 state is reapplied after reconnect
  • The original 0x00 state and test configuration were restored after verification

Screenshot

codex-clipboard-2e2d41d0-7d49-49b8-952e-e7afb23362aa

Testing

cargo fmt --all -- --check
git diff --check upstream/master...HEAD
RUSTFLAGS="-D warnings" cargo clippy --workspace --all-targets -- -D warnings
RUSTFLAGS="-D warnings" cargo test --workspace
cargo test -p openlogi-device disable_keys
cargo test -p openlogi-desktop disable_keys
cargo test -p openlogi-desktop smooth_scroll_change_reloads_the_agent_once
cargo xtask ci wasm
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --document-private-items --exclude openlogi-ui --exclude openlogi-desktop --exclude openlogi-overlay --exclude openlogi-agent

Part of #521

@safonin
safonin requested a review from AprilNEA as a code owner August 25, 2026 15:03
@greptile-apps

greptile-apps Bot commented Aug 25, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds capability-aware Disable Keys controls across the HID++, agent, IPC, configuration, and desktop layers. The latest changes also complete the reconnect behavior by scheduling bounded follow-up reapply attempts after offline-to-online transitions.

  • Adds guarded Disable Keys state reads, validated writes, and complete read-back confirmation.
  • Persists only firmware-supported, hardware-confirmed key states.
  • Routes operations through the agent-owned current keyboard channel.
  • Retries volatile configuration reapply after discovery, reconnect, and system wake.
  • Adds capability-gated UI controls, localization, mocks, and focused coverage.

Confidence Score: 5/5

The PR appears safe to merge because the previously reported reconnect reapply gap is fixed and no blocking failure remains.

The reconnect path now records a bounded follow-up retry budget, persists it across inventory refreshes, and invokes the Disable Keys reapply operation for each eligible retry target; no blocking failure remains.

Important Files Changed

Filename Overview
crates/openlogi-agent-core/src/orchestrator.rs Reconnect targets now receive the same bounded follow-up reapply run as initial discovery and system wake, resolving the previously reported one-shot reconnect behavior.
crates/openlogi-agent-core/src/orchestrator/tests.rs Adds focused coverage showing that offline-to-online transitions enqueue and consume bounded confirmation retries.
crates/openlogi-agent-core/src/hardware.rs Adds the detached, guarded Disable Keys write used by reconnect and wake reconciliation.
crates/openlogi-device/src/write/disable_keys.rs Implements supported-mask validation, unknown-bit preservation, and complete read-back confirmation for Disable Keys replacements.
crates/openlogi-desktop/src/features/keyboard/disable_keys.rs Adds the capability-gated desktop controls and asynchronous state handling for firmware-supported keys.
crates/openlogi-ipc/src/ipc.rs Appends the Disable Keys read and write operations to the versioned agent protocol.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Keyboard reconnects] --> B[Inventory reports offline-to-online]
  B --> C[Plan initial volatile reapply]
  C --> D[Write configured Disable Keys mask]
  C --> E[Queue bounded follow-up retries]
  E --> F[Next inventory refresh]
  F --> G{Keyboard online with route?}
  G -->|Yes| D
  G -->|No| H[Stop pending retry run]
  D --> I[Read back complete supported mask]
  I --> J{State confirmed?}
  J -->|Yes| K[Configured state restored]
  J -->|No| F
Loading

Reviews (2): Last reviewed commit: "fix(agent): retry volatile settings afte..." | Re-trigger Greptile

Comment thread crates/openlogi-agent-core/src/orchestrator.rs
@davidbudnick davidbudnick added type: feature New feature request platform: all Cross-platform issue labels Aug 25, 2026
@safonin
safonin force-pushed the feat/keyboard-disable-keys-controls branch from fd94176 to fac4720 Compare August 25, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: all Cross-platform issue type: feature New feature request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants