Command-line interface
The OpenLogi command-line interface (CLI) is a local tool for discovering Logitech hardware, reading device state, applying selected settings, checking hardware support, building privacy-safe device fixtures, and driving scripted Agent operations through stable JSON. Commands use shared hardware services or the resident Agent according to their ownership needs. Discovery, semantic fixture capture, backlight control, and the api command use the resident Agent so their view matches the desktop product. See Application composition for the wider process model.
Runtime boundary
The openlogi binary is a short-lived command process. It parses one command, talks to a local HID, UVC, asset, fixture, or Agent service, prints a result, and returns an exit status. Many device-changing commands use shared hardware-facing services directly rather than the desktop application's Agent IPC path. Backlight control is an Agent-owned exception. The api command is the Agent-only automation path and has no direct hardware fallback. The desktop application and Agent use interprocess communication for a resident runtime.
The CLI has shared Agent access paths for commands that need the resident device view. They identify the CLI as a client and give a connected Agent a bounded time to return one device snapshot. The general discovery path can fall back to direct enumeration when the Agent is unavailable. Backlight control, semantic fixture profile capture, and the api path do not fall back because their operations depend on Agent-owned routes, state, or persistence.
This boundary makes the CLI useful when the desktop application is not running, but not every command is independent of the Agent. The list command uses the Agent's inventory when a compatible Agent is available and falls back to direct enumeration when it is not. Backlight control, semantic fixture profile capture, and api operations require a responsive matching Agent. Direct fixture case capture requires the Agent to be stopped so the CLI can own the hardware path. A successful direct CLI write is not, by itself, a change to OpenLogi's desktop configuration or Agent state. An api write with --save is the exception: it updates the shared configuration and asks the Agent to reload it after verified hardware readback.
The main runtime relationship is:
flowchart LR
User[Operator or script] --> CLI[openlogi CLI]
CLI --> HID[Local Logitech HID++ devices]
CLI --> UVC[Local Logitech UVC cameras]
CLI --> Assets[Asset mirrors and local asset depot]
CLI -. list, backlight, profile, and api .-> Agent[Resident Agent]
CLI --> Fixtures[Sanitized fixture files]
Desktop[Desktop application] --> Agent
Agent --> HID
Agent --> UVC
Command surface
The command tree groups work by its operational goal. A bare invocation runs list, so the first action for an unknown host is hardware discovery.
| Command | Operational goal | Result or scope |
|---|---|---|
list | Discover connected Logitech HID++ devices, standalone devices, and webcams | Reads the resident Agent's inventory when possible and otherwise scans directly. It reports receivers, paired devices, battery data, standalone devices, camera capabilities, and HID-only products when no supported device is found. Exit status 2 means the scan worked but found no supported hardware. |
api | Provide versioned JSON automation through the running Agent | Reads Agent health and device projections or applies selected DPI, SmartShift, Fn lock, OS layout, report rate, and Easy-Switch changes. Writes affect live hardware except OS layout, which is an Agent setting. --save is opt-in and also updates shared configuration after applicable readback. |
backlight | Inspect or change a keyboard's white backlight | Requires the running Agent. status is the default. It can change enabled state, automatic brightness, fixed level, battery-saving behavior, and the key-light duration persistently. |
snapshot | Capture one webcam frame | Writes a PNG file. The default path is snapshot.png. |
camera | Inspect or change webcam image controls | get is the default. set changes a device-level control or automatic mode that other camera applications can see. |
light | Discover and control standalone Logitech lights | Supports discovery, status, power, brightness, and colour temperature. It reports device readback when the light supports it and identifies raw-report-only access when it does not. |
diag | Check HID++ support and verify selected read/write paths | Provides feature, control, battery, DPI, pointer-speed, SmartShift, lighting, wheel, onboard-profile, mouse-button, multi-host, headset sidetone, keyboard-zone, and raw feature-call checks. It is for diagnosis rather than desktop configuration. |
fixture | Record, contribute, and verify privacy-safe device fixtures | Captures semantic profiles through Agent IPC, records read-only HID++ cases through direct access, assembles resumable contributions, and checks fixture directories without hardware. See Fixture workflows. |
assets sync | Prepare device assets for packaging | Updates the local desktop asset depot from the asset registry and removes obsolete device depots. |
All commands accept the standard help and version forms supplied by the command parser. Logging goes to standard error and uses OPENLOGI_LOG when an operator needs more detail than normal command output.
References: crates/…/lib.rs• L1-37 crates/…/cmd.rs• L1-64 crates/…/Cargo.toml• L13-29
Agent automation
api is the machine-facing command surface for scripts that must use the same device view and ownership model as the running Agent. It returns one JSON object for every attempt, including connection, validation, hardware, and persistence failures. The envelope has schema version 1, an ok flag, and either data or a stable error code. Human-oriented logs stay on standard error so standard output remains suitable for a JSON consumer.
The command uses opaque device IDs returned by api devices. A script should refresh that inventory before selecting a device because the ID is an exact route and duplicate routes remain ambiguous. status reports Agent health without a new hardware enumeration, while devices exposes a deliberate view of inventory, online state, battery, and measured capabilities without unrelated private runtime state. Unknown values remain explicit, and private model, pairing, and foreground-application data does not cross the JSON boundary.
The setting commands use explicit state rather than toggles. dpi and report-rate validate requested values against device-reported support. smartshift changes only the fields supplied by the caller and retains the rest. fn-lock and os-layout accept on or off, but OS layout is saved as an Agent preference rather than written to the keyboard immediately. easy-switch reads host channels and can rename one channel. Hardware writes are read back before the CLI reports success, so a firmware response that does not match the request becomes an error rather than a false success.
Device operations also require a ready Agent inventory. The CLI rejects an unknown, offline, or duplicate opaque ID before it sends a device request, so a stale inventory cannot silently route a write to another device.
The following sequence shows the intended automation workflow.
sequenceDiagram
participant Script
participant CLI as openlogi api
participant Agent
participant Device
Script->>CLI: api devices
CLI->>Agent: snapshot
Agent-->>CLI: opaque IDs and capabilities
CLI-->>Script: JSON inventory
Script->>CLI: setting command with exact ID
CLI->>Agent: read, validate, and write or stage
Agent->>Device: hardware operation when needed
Device-->>Agent: observed state
Agent-->>CLI: readback or saved preference
CLI-->>Script: JSON result or stable error
References: crates/…/api.rs• L1-169 crates/…/api.rs• L171-277 crates/…/tests.rs• L121-243
Agent setting persistence
api --save connects a live hardware change to the desktop configuration without making saving the default. It first resolves the selected route to a persistent device identity and prepares a configuration edit. The edit is committed only after the Agent confirms the requested hardware state through readback. This keeps a failed or mismatched hardware write from creating a saved preference that the device did not accept. The save path also checks configuration rules before hardware I/O, including the supported floor for a SmartShift threshold.
OS layout is different because it is an Agent setting. The command requires --save and records whether the Agent should keep the host operating system's key layout when the keyboard connects or changes layout. It does not perform an immediate keyboard write. Easy-Switch names are device state and are not part of this configuration save path.
After the file is saved, the CLI asks the Agent to reload the configuration. The JSON result distinguishes three useful states: the setting was not saved, the setting was saved and reload succeeded, or the setting was saved but reload failed or its acknowledgement was lost. A device without a stable identity cannot use --save, and a per-link override must be changed in configuration before a device default can be saved.
References: crates/…/api.rs• L145-169 crates/…/api.rs• L182-276 crates/…/persistence.rs• L14-113 crates/…/persistence.rs• L115-186 crates/…/tests.rs• L590-667
Hardware discovery
list is the entry point for a host check. It presents Logitech HID++ receiver relationships and paired-device state with standalone Logitech devices and Logitech UVC camera capabilities. When the resident Agent responds with the current protocol, the command uses the Agent's inventory because the Agent already owns device permissions. If the Agent is absent, stalled, or incompatible, the CLI scans HID++ devices and standalone devices directly. A failed direct standalone scan does not hide successful HID++ results. Camera discovery runs as a separate local check.
The report identifies online and offline paired devices, their receiver slots, battery state, and available model and transport data. It also reports standalone device identity and driver information, plus each discovered camera's identifier and available maximum resolution or frame rate. When no supported HID++ device, standalone device, or webcam is found, the command performs a plain HID listing to show Logitech products that lack a usable HID++ interface. That hint helps distinguish an unsupported interface from an empty host.
The Agent query has a bounded connection and call wait. A failed handshake, protocol mismatch, disconnect, or timed-out snapshot therefore does not block discovery. The source note stays on standard error so scripts can parse standard output. A no-hardware result is distinct from an enumeration failure. The command returns exit status 2 after a successful empty scan and prints platform-specific guidance based on the Agent status when that status is available. The guidance points to Input Monitoring on macOS, competing HID access on macOS, or OpenLogi's udev rules on Linux.
References: crates/…/list.rs• L16-119 crates/…/list.rs• L121-181 crates/…/list.rs• L183-273 crates/…/agent.rs• L17-62
Device settings
The settings commands apply focused changes to a selected device without requiring the desktop window. Most direct device commands use shared hardware services. Keyboard backlight is different: the CLI routes it through the resident Agent, which owns the runtime HID access and confirms the resulting state. The backlight path gives its snapshot, read, and write stages one bounded budget and does not retry a stalled or disconnected call, so a write with no confirmed reply is not reported as successful.
| Workflow | Main commands | Operational meaning |
|---|---|---|
| Keyboard backlight | backlight status, backlight on, backlight off, backlight auto, backlight level, backlight battery-saving, backlight duration | Requires a running compatible Agent. Reads the current mode, level, and supported controls or changes the keyboard's stored enabled state, automatic mode, level, battery-saving behavior, or timer. These settings survive reconnects and power cycles. The status result distinguishes a software mode from a temporary level selected by the keyboard's own keys. |
| Webcam controls | camera get, camera set <control> <value> | Reads ranges and current values or writes image controls and automatic modes to the camera. |
| Webcam capture | snapshot [path] | Captures one frame for a quick device or permission check. |
| Standalone light | light list, light status, light on, light off, light brightness, light temperature | Finds supported lights and changes their power, brightness, or colour temperature. The driver checks native brightness against the range reported by the light, or its model range when the light has only raw-report access. |
These commands operate at different persistence layers. Keyboard backlight writes go through the Agent to the keyboard's stored configuration. Camera control writes are device-level changes. Standalone light commands affect current hardware operation and report readback where the device supports it. None of these commands updates config.toml or asks the Agent to reconcile a desktop profile.
References: crates/…/backlight.rs• L1-19 crates/…/backlight.rs• L24-161 crates/…/backlight.rs• L171-248 crates/…/agent_routing.rs• L150-191 crates/…/agent_routing.rs• L430-525 crates/…/camera.rs• L1-102 crates/…/snapshot.rs• L1-44 crates/…/light.rs• L1-26 crates/…/light.rs• L69-117 crates/…/light.rs• L120-258
Fixture workflows
The fixture commands turn real-device observations into privacy-safe files that support tests and replay. They separate semantic state from protocol evidence. This allows a fixture to describe device behavior without retaining private hardware identity or host state. Semantic profile capture uses one Agent snapshot as its selection and inventory source, then reads only the semantic values needed for the selected profile.
| Workflow | Command | Operational meaning |
|---|---|---|
| Semantic profile | fixture record profile | Reads one selected device through the running Agent, keeps the needed receiver or direct-device context, removes runtime-only data, replaces hardware identities with shared synthetic identities, and writes a validated profile. It never falls back to direct hardware access. |
| Read-only protocol case | fixture record case | Reads one allowed HID++ operation through direct CLI hardware access, rejects unsafe or incomplete evidence, sanitizes identities, and writes one cassette only after exact self-replay succeeds. |
| Complete contribution | fixture contribute | Runs the profile step first, then resumes after the Agent is stopped to record the standard read-only cases for the same physical route. --profile-only publishes only the semantic profile. |
| Fixture validation | fixture verify <directory> | Checks the manifest, profile, declared cases, privacy ledger, relationships, and replay framing without hardware. |
The normal complete contribution is a two-phase ownership workflow. The first phase uses one Agent snapshot and Agent reads for semantic settings. A receiver profile stays stable whichever paired device selects that receiver, while a direct-device profile retains only the selected link. The profile path records known unsupported and unavailable settings without guessing unknown offline support. It also captures supported semantic values such as DPI, SmartShift, wheel mode, backlight, Easy-Switch, and press-force state. If a sibling paired device has no usable identity, the profile drops that device rather than publish a device that cannot be related to settings. The second phase uses direct HID access with a lock and requires the same receiver route and slot or the same direct device identity class. The command writes the final manifest and cases only after the privacy and replay gates pass.
Direct case capture is restricted to read-only operations. It admits capture only when the Agent lock is free and its endpoint is definitively unreachable. Device discovery during this phase can enable receiver notifications, so the workflow warns that those notification flags are not restored even though the captured operations do not change device settings or pairings. The sanitizer reports identity replacements and rejects evidence that has unsafe traffic, incomplete exchanges, private identity without a safe replacement, or an unproven write.
The contributed corpus also checks that every declared diagnostic case replays through the same production read and consumes all required exchanges. Reviewed feature, control, and battery expectations catch a fixture that is structurally valid but no longer describes the intended device behavior. The reviewed cases cover feature tables, reprogrammable controls, raw battery reports, DPI, SmartShift, wheel mode, backlight state, and force-sensing state for supported specimens.
This diagram shows how fixture data moves from an Agent snapshot or direct read into validated files.
flowchart LR
Operator[Operator] --> Profile[fixture record profile]
Profile --> Agent[Running OpenLogi Agent]
Agent --> SanitizedProfile[Synthetic semantic profile]
Operator --> Case[fixture record case]
Case --> Direct[Direct read-only HID++ access]
Direct --> Sanitizer[Privacy and safety checks]
Sanitizer --> Replay[Strict self-replay]
Replay --> Cassette[Sanitized HID cassette]
SanitizedProfile --> Verify[fixture verify]
Cassette --> Verify
Verify --> Fixture[Verified fixture directory]
References: crates/…/fixture.rs• L13-59 crates/…/record_profile.rs• L24-131 crates/…/record_profile.rs• L144-365 crates/…/tests.rs• L676-843 crates/…/tests.rs• L1052-1181 crates/…/tests.rs• L1183-1222 crates/…/record_case.rs• L59-78 crates/…/record_case.rs• L226-318 crates/…/corpus_diagnostics.json• L1-341 crates/…/corpus_tests.rs• L19-101 crates/…/replay.rs• L13-132 crates/…/contribute.rs• L83-203 crates/…/verify.rs• L16-31 crates/…/tests.rs• L11-133
Hardware diagnostics
diag is a safe operational surface for learning what a real device reports and for proving that a hardware write path works. Direct checks use the same HID++ path as the desktop application but do not use the desktop configuration file or GUI. Most round-trip checks read a value, make a small change, read it back, and restore the original value before reporting success. The host-switch check is an Agent-owned exception because the device leaves this computer's radio link after the switch. The zones check is an interactive mapping workflow: it lights one keyboard zone at a time and records the key that the operator sees.
diag hidpp is the exploratory raw-call path for a HID++ 2.0 feature. It selects a device that advertises the requested feature, then sends one or more function calls and prints the replies without assigning meaning to the payload. A raw call can change device state as easily as it can read state, so this command is for operators who know the feature contract rather than for routine configuration.
| Diagnostic | Use |
|---|---|
diag features | Show the HID++ feature and firmware information exposed by online devices. |
diag controls | Show reprogrammable control entries and their capabilities. |
diag battery | Show the raw battery report from the device. |
diag dpi | Verify a supported DPI write, accept a supported hardware adjustment, and restore the prior DPI. |
diag smartshift | Verify a wheel mode change and restore it unless --leave-flipped is used. It can also set sensitivity or tunable torque while preserving the current mode and the other setting. |
diag lighting | Set an online RGB device to a solid colour through a selected lighting path. |
diag wheel | Read the wheel reporting mode or set low/high reporting resolution without changing desktop configuration. |
diag pointer-speed | Verify pointer scaling by writing a test value, checking the read-back, and restoring the original value. |
diag onboard | Read a G-series mouse's onboard profiles and current mode. |
diag mouse-buttons | Listen for button reports and show which HID++ slot each button uses. |
diag host-switch | Switch a multi-host device through the running Agent. The device may leave the current computer's radio link after the write. |
diag sidetone | Read or set a headset's sidetone level. |
diag zones | Walk a keyboard's lighting zones and save a tab-separated zone-to-key map for per-key lighting work. |
diag hidpp | Call one HID++ 2.0 feature with raw function and parameter bytes. It supports ordered scripted calls or an interactive session and requires the Agent to be stopped. |
Diagnostics choose an online paired device and can use --device to disambiguate it. Feature-aware checks first look for a device that advertises the feature under test, including the supported lighting and zone paths. This prevents a keyboard from receiving a mouse-only check when several devices are online. If no candidate advertises the feature, the command still selects an online device so the diagnostic can return the device-specific unsupported-feature result. The raw HID++ path uses the requested feature for the same first choice, then reports that the feature is absent if the selected device cannot serve it. Receiver-backed devices use their resolved receiver route, while online entries without a resolvable route are skipped instead of being treated as direct devices. The battery diagnostic selects any device that exposes one of the battery report types it can read, then reports a clear unsupported result if none is available. host-switch uses the same safe name and route selection through the Agent rather than opening the device directly.
Raw HID++ calls use the direct hardware path and hold the Agent ownership boundary for the full command. The command refuses to start while the Agent is running because an interactive session or call batch must not share a device channel with the resident runtime. A call list runs in order and stops when a call fails; an interactive session continues after an invalid input line but ends when the operator enters :q or input closes.
The zone workflow requires the Agent to be stopped because it does not take the Agent's lighting lock. It lights one 0x8081 zone at a time, accepts a key name, an empty answer for no visible light, :b to go back, or :q to stop, and saves accepted answers after each step to zones.tsv or the chosen output. This makes an interrupted walk useful without claiming that the map is complete.
On macOS, direct diagnostics request Input Monitoring access before they open a device. The request applies to the app that launched the CLI, such as Terminal, not to the resident Agent. A newly granted permission takes effect on the next CLI launch, so the operator must run the command again after granting access. host-switch does not need its own direct-device permission because the Agent owns that channel.
References: crates/…/diag.rs• L1-26 crates/…/diag.rs• L28-91 crates/…/diag.rs• L101-167 crates/…/battery.rs• L1-49 crates/…/zones.rs• L17-107 crates/…/input_monitoring.rs• L1-38 crates/…/pointer_speed.rs• L11-42 crates/…/pointer_speed.rs• L44-117 crates/…/dpi.rs• L25-99 crates/…/smartshift.rs• L33-120 crates/…/smartshift.rs• L142-200 crates/…/wheel.rs• L39-82
Asset preparation
assets sync is a packaging workflow rather than a user device workflow. It reads the asset registry from the fastest available mirror or from the source named by OPENLOGI_ASSETS, fetches each depot's bundle-required baseline files and registry-listed optional renders and variant hotspot metadata, keeps unchanged files from the local cache, and removes depots no longer in the registry.
The sync includes optional side renders, colour or handed variants, and their listed metadata when the registry names them. It warns when a device has no metadata or main render. It still keeps available files so an incomplete registry entry is visible without stopping the whole sync.
The default destination matches the desktop bundle resource path. The intended release sequence is:
- Run
openlogi assets sync. - Build the desktop bundle so it includes the refreshed local assets.
References: crates/…/sync.rs• L1-9 crates/…/sync.rs• L18-65 crates/…/sync.rs• L67-151 crates/…/lib.rs• L1-11
Device selection and results
Hardware selection is part of the command contract because one host can expose several receivers, paired devices, cameras, lights, or standalone devices. General device commands use their own documented selectors. Fixture capture uses a case-insensitive exact display name or an exact rendered route. The api command uses an exact opaque ID from api devices. Backlight and Agent-owned diagnostics use the Agent's online HID++ inventory and refuse ambiguous routes even when a name appears unique. Direct diagnostics resolve receiver-backed routes or direct-device routes before opening hardware. Writes stop when a selector matches none or more than one device, instead of applying a request to an uncertain target.
The CLI uses output for people and exit status for automation. Normal command failures return an error and a failure status. The list command is the exception: exit status 2 means no supported hardware was found, while an enumeration error remains a command failure. Its source note, HID-only hint, and empty-result guidance go to human-readable output without changing the machine-readable meaning of the scan. The api command always emits its JSON envelope and returns success only when the envelope reports success. Its Agent-only lookup cannot use the CLI process's own hardware permissions, so Agent availability and protocol compatibility are part of the automation contract. Backlight and host-switch follow the same Agent ownership rule and fail when connection or selection fails.
The camera path also has platform limits. Logitech cameras are standard UVC devices and the shared camera service supports capture and controls on macOS, Windows, and Linux. Camera permission or a platform without a camera backend can prevent capture even when the command itself parses correctly. Fixture profile capture and api operations also depend on a responsive Agent and a matching IPC protocol. Direct fixture case capture fails closed when the Agent may still own the hardware.
References: crates/…/diag.rs• L82-156 crates/…/diag.rs• L178-258 crates/…/light.rs• L220-258 crates/…/list.rs• L17-79 crates/…/list.rs• L106-181 crates/…/target_selection.rs• L13-65 crates/…/output.rs• L105-147 crates/…/api.rs• L145-169 crates/…/backlight.rs• L111-161 crates/…/agent_routing.rs• L403-525 crates/…/lib.rs• L1-13 crates/…/lib.rs• L271-281
Desktop relationship
The desktop product has a different lifetime and ownership model. The desktop application sends device work to the resident Agent service, and the Agent owns ongoing device state, event handling, and the IPC server. The CLI starts only for the requested operation. Its list command, backlight command, semantic fixture profile capture, host-switch, and api command may read or change state through that Agent, while its other setting and diagnostic commands use their own direct hardware paths. api --save also writes the shared configuration and asks the Agent to reload it. Direct fixture case capture requires the Agent to be absent so the CLI can use its own HID permission and identity. See Desktop application for the long-running product path.
This distinction matters during diagnosis, automation, and fixture work. A successful diag result shows that the local hardware path can complete a read or write on the host, except for Agent-owned host-switch, which shows that the Agent completed the requested route change. A successful backlight result shows that the Agent completed and confirmed an Agent-owned persistent keyboard change. A successful semantic profile capture shows what the Agent reported after a single snapshot and its required semantic reads. A successful api result shows that an Agent-owned read or write matched the JSON contract, and a saved result additionally describes configuration persistence. A successful case capture shows that one read-only operation can be replayed from sanitized evidence. None of these results proves that the desktop UI will display the same state without its normal observation flow, except that a successful saved API change also requests an Agent configuration reload.
References: crates/…/server.rs• L1-7 crates/…/server.rs• L90-128 crates/…/server.rs• L212-231 crates/…/ipc.rs• L1-21 crates/…/agent.rs• L17-62 crates/…/api.rs• L145-276 crates/…/backlight.rs• L111-161 crates/…/diag.rs• L1-9 crates/…/record_profile.rs• L44-57 crates/…/tests.rs• L676-843 crates/…/record_case.rs• L258-317
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the top-level command tree in crates/…/cmd.rs aligned with dispatch behavior in crates/…/lib.rs and crates/…/main.rs.
- When Agent access changes, preserve the CLI client declaration, bounded connection and call waits, and the discovery fallback without adding a direct fallback to backlight control, semantic profile capture, or
apiautomation. - When the
apiJSON surface changes, preserveschema_version, theokenvelope shape, stable error codes, deliberate data projections, and standard-output-only JSON. - When
api devicesor device selection changes, keep exact opaque IDs, duplicate detection, inventory-readiness checks, and the rule that failed selection sends no device RPC. - When API setting writes change, preserve capability validation, partial SmartShift updates, explicit Fn lock and OS layout state, report-rate validation, Easy-Switch channel numbering, readback checks, and the distinction between live hardware success and saved configuration success.
- When API persistence changes, keep identity resolution aligned with device routes and configuration keys. Preserve conflict detection, per-link override protection, atomic file preservation, SmartShift configuration-floor validation, the OS layout requirement for
--save, and the Agent reload acknowledgement states. - When discovery changes, preserve the Agent-first snapshot path, direct-enumeration fallback, source note on standard error, and the report fields for receiver relationships, paired-device state, battery data, model and transport data, standalone devices, HID-only hints, and camera capabilities.
- Preserve the
listexit-status distinction because scripts may treat no hardware differently from an enumeration failure. Keep a failed standalone scan from hiding a successful HID++ listing. - When a command adds or changes a device selector, check ambiguity behavior against receiver-backed devices, direct devices, cameras, standalone lights, standalone HID devices, fixture targets, and exact API IDs.
- When keyboard backlight actions change, keep Agent ownership, same-profile connection requirements, capability-aware selection, one shared deadline for snapshot/read/write, no retry after disconnect, read-back output, the distinction between temporary keyboard-key mode and software-written mode, duration validation, and non-volatile persistence aligned.
- When camera controls change, keep the set of device controls and automatic modes aligned with the shared UVC service and its device-level persistence.
- When standalone-light controls change, keep percent and native-lumen inputs aligned with advertised capability ranges and unambiguous device selection. Preserve status handling for lights that support raw reports but no readback.
- When diagnostic commands change, keep the command tree, feature-aware candidate selection, direct-route resolution, and all Agent-owned exceptions aligned. Preserve the rule that
host-switchdoes not request direct-device permission. Keep interactive zone mapping aligned with the0x8081capability, Agent exclusion, incremental output, and stop/back input. - When raw HID++ diagnostics change, keep feature-aware selection, Agent exclusion, function and parameter limits, ordered-call failure handling, and the warning that raw calls can change device state aligned.
- When SmartShift diagnostics change, keep zero-value rejection, mutually exclusive modes, mode preservation for sensitivity and torque changes, capability checks, and read-back validation aligned.
- When a diagnostic writes a device value, keep its stated restore or leave-changed behavior aligned with the underlying hardware call. For DPI, accept only a supported non-no-op read-back before restoring the original value. For pointer scaling, restore the original value before judging the test write.
- When the asset registry or desktop bundle resource path changes, update the
assets syncdestination and packaging sequence together. Include registry-listed side, variant render, and variant hotspot metadata in the offline asset set. - When a camera control or permission contract changes, check both the CLI operation and the shared UVC backends used by desktop camera features.
- When fixture commands or fixture schemas change, keep profile-only output, complete contributions, manifest relationships, and strict directory verification aligned.
- When semantic profile capture changes, preserve the Agent-only boundary, one-snapshot selection model, synthetic identity mapping, semantic read timeouts, Easy-Switch name sanitization, force-sensing capture, capability coverage for captured settings, and fail-closed handling of unknown offline support.
- When direct case capture changes, preserve Agent exclusion, exact target selection, the read-only operation allowlist, bounded recording, identity sanitization, single-candidate self-replay, and atomic publication.
- When direct capture admission changes, keep the instance lock and healthy-endpoint probe as one ownership gate so an Agent cannot start between the checks.
- When a fixture route or identity policy changes, update both the profile route and cassette replay route so receiver slots remain related without exposing original identities. Drop identity-less sibling devices rather than publishing unrelatable profile entries.
- When the fixture operation allowlist or replay decoder changes, update the reviewed corpus diagnostics and production-operation replay checks together so declared coverage and semantic expectations do not drift.
- When fixture filesystem rules change, keep manifest declarations, safe case paths, non-symlink assets, schema checks, and corpus-wide walking aligned between CLI verification and
openlogi-fixtureloading. - When macOS direct-device access changes, keep the permission request on every direct path, apply it to the launching app, and preserve the next-launch requirement after a new grant.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| No HID++ device, standalone device, or Logitech webcam is present | list reports no supported hardware and returns status 2 | Treat status 2 as an empty scan. Investigate enumeration errors separately. |
| The Agent is unavailable, stalled, or speaks another protocol version | list falls back to direct enumeration. Backlight, profile capture, host-switch, and api operations stop because they have no direct-hardware fallback | Read the source note on standard error for discovery. Start a responsive Agent with the matching protocol for Agent-only workflows. |
| A failed backlight snapshot, read, or write reaches the shared deadline or the Agent disconnects | The command stops without retrying. A write outcome can be unconfirmed and no read-back success is printed | Read status before deciding whether to retry. Check the Agent and device state first. |
| A direct standalone-device scan fails while HID++ enumeration succeeds | list keeps the HID++ results but reports the standalone scan failure | Treat the result as partial discovery and inspect the stderr warning before retrying. |
| The host exposes a Logitech product without a HID++ interface | list returns status 2 even though it prints the HID-only product hint | Use the platform guidance in the hint. OpenLogi cannot configure a product that exposes no usable HID++ interface. |
An api consumer parses a changed JSON envelope or error code | Automation can misread a successful result or lose a useful failure category | Treat schema_version, ok, data, error.code, and persistence values as external contracts. |
api devices is stale, inventory is not ready, or an opaque ID is duplicated | An API setting operation stops before device I/O | Refresh the device projection and require one exact online ID. Do not replace IDs with display names. |
| An API write is accepted by transport but readback differs | The command returns readback_mismatch and does not report success | Treat the observed device state as authoritative and retry only after the device is stable. |
os-layout is used without --save | The command refuses the request because OS layout is an Agent setting | Use --save and a device with a stable identity. |
--save is used for a read-only API command or a device lacks a persistent identity | No configuration edit is made | Use --save only with an explicit setting change on an identified device. |
| A per-link override already controls DPI or SmartShift | The API refuses to save a device default that would be hidden by the route override | Edit the configuration's link override or remove it before saving a device default. |
| A SmartShift state is below the configuration's supported save floor | The live operation may be valid, but --save is rejected before it creates a configuration edit | Read or set an explicit supported threshold before saving the device default. |
| Configuration changes after the hardware write or the file is busy | Hardware may have changed, but the configuration is not overwritten and the result reports not_saved | Resolve the config conflict or busy file before retrying. |
| Configuration saves but Agent reload fails or its acknowledgement is lost | The preference is saved, but the resident Agent may still use its prior state | Treat the result as saved with reload failure or unknown acknowledgement. Check Agent state before repeating the write. |
Backlight control or host-switch is run without a matching Agent | No Agent-owned hardware operation is confirmed | Start the Agent in the same OPENLOGI_PROFILE and wait for a ready inventory. Do not expect a direct CLI fallback. |
| Several backlight or Agent-owned diagnostic devices match, a route is unresolved, or a direct route is duplicated | The command stops before the Agent RPC or hardware write | Use one exact-enough name match and a uniquely resolvable Agent route. |
| A backlight action is not supported by the selected keyboard | The Agent rejects the read or write, and the CLI does not claim confirmation | Run backlight status and use only the controls the keyboard reports. |
| A backlight level comes from temporary keyboard-key mode | An unrelated software write can return the keyboard to automatic ambient-light behavior | Use backlight auto or backlight level when the software-owned mode must be explicit. |
| A backlight duration is not a five-second step or exceeds two hours | Argument parsing rejects the request before an Agent write | Use a duration from 5 through 7200 seconds in five-second steps. |
| An online semantic read fails, or an offline device lacks a captured support fact | The profile is not written. The error does not expose transport or hardware identity details | Restore a stable Agent/device state. Do not treat an unknown offline capability as unsupported. |
| Several devices match no explicit selector | A write or fixture capture stops instead of choosing an uncertain device | Pass a more specific selector. Fixture selectors must be exact. |
Several standalone lights match a --device query or no query is given for multiple lights | A light write stops without changing any device | Use a case-insensitive name or identity fragment that matches one light. |
| A light receives a native-lumen value outside its advertised or model range | The brightness request is rejected before the hardware write | Use the range and unit reported by light list, or use normalized percent when supported. |
| A light is reachable only through a raw report with no readback | light status cannot show a verified state after access | Treat the raw-report note as a capability limit. Use light list and the device's advertised controls before changing it. |
| A receiver-backed online device has no resolvable device route | A diagnostic skips that device instead of risking a write to the receiver itself | Retry after enumeration exposes a valid receiver identity and slot, or select another online device. |
| A diagnostic runs against a device without its required HID++ feature | The operation cannot perform the requested check | Use feature-aware selection or choose a compatible device with --device. |
diag hidpp starts while the Agent is running | The raw session refuses to start so two processes cannot share the device channel | Quit the Agent before making raw feature calls. |
| A raw HID++ call has an invalid function or parameter form | The call is rejected before hardware access, or an ordered batch stops at the failed call | Use a function number from 0 through 15 and no more than sixteen hex parameter bytes. |
| A raw HID++ feature is absent or a call returns an error | The command reports the feature or call failure and does not claim a useful reply | Run diag features first and treat the device reply as authoritative. |
| SmartShift sensitivity or torque is zero, out of range, or combined with another mode | Argument parsing rejects the request before hardware access | Use a non-zero sensitivity from 1 to 255, torque from 1 to 100, and select one SmartShift action. |
| A SmartShift torque device lacks the tunable-torque feature or read-back differs | The command reports unsupported hardware or a failed write rather than claiming success | Use a device that advertises tunable torque and treat the read-back as authoritative. |
| A DPI diagnostic gets an unchanged or unsupported read-back | The round-trip fails, and the original DPI may not be restored if the restore stage is not reached | Use a different supported target. Treat the read-back as the device result and inspect the device if restoration fails. |
| Pointer-speed test write, read-back, or restore fails | The command reports the failing stage. A failed restore can leave the test value on the device | Treat restore failure as a device-state issue and check the reported original and current scaling before retrying. |
| A multi-host switch succeeds on the device but the device leaves the current radio link | The CLI may lose its current device channel immediately after the Agent write | Use the Agent-owned command and confirm the device from the target host or channel. |
diag zones starts while the Agent is running | The interactive walk refuses to start because Agent lighting activity can conflict with the direct walk | Quit the Agent before mapping zones, then review the incrementally saved map. |
| A zone walk is stopped or its output cannot be written | The map is partial or the walk stops before the next zone | Use the saved tab-separated file as the partial result and choose a writable output path for a complete walk. |
diag is mistaken for desktop configuration | A direct test may change hardware state but does not update config.toml or the Agent | Use the desktop settings flow or API save flow for persistent OpenLogi profile behavior. |
| macOS Input Monitoring is not granted to the app that launched the CLI | Direct diagnostics and direct fixture capture fail before device access | Grant access to Terminal or the app that launched openlogi, then run the command again after the grant. |
| Camera permission is denied or capture is unsupported on the platform | snapshot cannot produce a frame even if camera discovery succeeds | Grant camera access on a supported platform and report the capture error to the operator. |
| An asset mirror or registry entry is incomplete | Some device resources, including variant hotspot metadata, are not refreshed and the desktop bundle may lack required renders or metadata | Review sync warnings and the reported fetched, cached, and total bundle counts. |
| Direct fixture capture cannot take the Agent instance lock or its endpoint is active or unhealthy | Capture stops before hardware access to avoid mixed ownership or unsafe identity handling | Stop the Agent fully and retry after its lock and endpoint are gone. |
| Direct fixture discovery enables receiver notifications | Receiver notification flags can remain changed after capture even though the recorded operation is read-only | Treat the warning as part of the workflow and restore the receiver state outside the capture command if needed. |
| A read-only fixture capture contains unsafe traffic, private identity, incomplete evidence, or more than one replay candidate | No cassette is published | Keep the operation in the read-only allowlist and resolve the sanitizer or replay failure before retrying. |
| A complete contribution resumes with a different ID, name, route, or output layout | The partial contribution is rejected instead of being merged into a different fixture | Reuse the same command metadata and structural device route, or start a new output directory. |
| A receiver profile includes a sibling device without a usable identity | The sibling is omitted from the published profile so it is not related to settings that cannot be verified | Capture with stable device identities, or accept the reduced profile rather than restoring a guessed identity. |
| The reviewed corpus lacks a declared case, expected diagnostic, or complete replay exchange | Fixture coverage or semantic behavior can drift without a matching production read | Keep corpus case names aligned with the operation allowlist and review expectations whenever a read changes. |
fixture verify finds an extra, missing, symlinked, undeclared, or schema-invalid fixture asset | The fixture directory fails validation before it can be treated as a complete corpus member | Keep only the manifest, profile, and exactly the cases declared by the manifest. |
Key files
| File | Why to read it |
|---|---|
| crates/…/main.rs | Shows the executable entry point and how the CLI exit status reaches the operating system. |
| crates/…/Cargo.toml | Shows the shared runtime services that give the CLI access to hardware, Agent IPC, fixtures, cameras, and assets. |
| crates/…/lib.rs | Defines argument parsing, the default list behavior, logging, dispatch, and command-tree checks. |
| crates/…/cmd.rs | Defines the public command groups, including Agent-only JSON automation, dispatch behavior, and their operational roles. |
| crates/…/api.rs | Defines the versioned JSON automation commands, Agent-only execution path, live setting writes, readback checks, and opt-in save behavior for device settings and OS layout. |
| crates/…/output.rs | Defines the deliberate JSON projection, opaque device IDs, inventory health, exact selection, and stable error boundary. |
| crates/…/persistence.rs | Defines configuration identity resolution, safe save staging, conflict handling, SmartShift save validation, and Agent reload reporting. |
| crates/…/tests.rs | Shows the API contract for projections, privacy boundaries, exact selection, read-only operations, write readback, and stable failure codes. |
| crates/…/agent.rs | Defines the CLI's Agent client identity and bounded snapshot request used by Agent-aware commands. |
| crates/…/list.rs | Shows the Agent-first discovery report, direct fallback, partial standalone-scan handling, HID-only hints, receiver and paired-device details, camera capabilities, platform notes, and script-facing empty-result status. |
| crates/…/backlight.rs | Shows the Agent-owned persistent keyboard backlight workflow, route selection, capability-aware actions, deadline handling, duration validation, temporary-mode warning, and read-back reporting. |
| crates/…/agent_routing.rs | Shows the no-fallback ownership boundary, route selection guarantees, shared deadline, no-retry failure handling, and Agent-confirmed output. |
| crates/…/camera.rs | Shows the device-level webcam control workflow. |
| crates/…/light.rs | Shows standalone-light discovery, selection, dynamic range checks, readback, raw-report fallback, and control. |
| crates/…/diag.rs | Shows the diagnostic command surface, direct versus Agent-owned paths, device selection, feature-aware routing, and macOS permission gating for the shared direct hardware path. |
| crates/…/hidpp.rs | Shows exploratory raw HID++ 2.0 feature calls, direct ownership checks, call parsing, interactive use, and reply reporting. |
| crates/…/zones.rs | Shows the interactive keyboard-zone mapping workflow, Agent exclusion, incremental TSV output, and operator controls for stepping through zones. |
| crates/…/battery.rs | Shows raw battery report selection across supported battery feature types and the device-level unsupported result. |
| crates/…/input_monitoring.rs | Shows the macOS permission gate for direct device access and its next-launch behavior. |
| crates/…/smartshift.rs | Shows SmartShift mode checks, sensitivity and torque changes, feature checks, preservation rules, and read-back behavior. |
| crates/…/dpi.rs | Shows the DPI round-trip diagnostic, supported-value handling, and restore behavior. |
| crates/…/pointer_speed.rs | Shows the pointer scaling round-trip diagnostic and its restore-first behavior. |
| crates/…/onboard.rs | Shows the G-series onboard-profile inspection path. |
| crates/…/mouse_buttons.rs | Shows the mouse-button report inspection path and HID++ slot output. |
| crates/…/host_switch.rs | Shows the Agent-owned multi-host switch path for devices that leave the current radio link. |
| crates/…/fixture.rs | Defines the fixture command family and separates contribution, recording, and verification workflows. |
| crates/…/record_profile.rs | Shows Agent-only semantic capture, one-snapshot profile selection, synthetic data projection, safe publication, capability reads, and fail-closed handling. |
| crates/…/tests.rs | Shows the guarantees for one-snapshot capture, privacy removal, route stability, Easy-Switch sanitization, force-sensing capture, identity-less sibling handling, and fail-closed reads. |
| crates/…/record_case.rs | Shows direct read-only HID++ capture, ownership admission, operation selection, and cassette publication. |
| crates/…/corpus_diagnostics.json | Holds reviewed diagnostic expectations for contributed device cases, including battery and other semantic reads. |
| crates/…/corpus_tests.rs | Checks that declared corpus cases use production operations and consume complete replay data. |
| crates/…/replay.rs | Shows sanitized route derivation, exact single-candidate selection, and strict production-operation self-replay before a cassette is accepted. |
| crates/…/contribute.rs | Shows the resumable two-phase contribution workflow and profile-only path. |
| crates/…/audit.rs | Shows the privacy and evidence gate for sanitized cassette candidates, including identity replacement reporting and rejection reasons. |
| crates/…/verify.rs | Shows strict fixture directory, schema, relationship, and replay validation without hardware access. |
| crates/…/tests.rs | Shows corpus-wide filesystem checks for exact declared assets, safe paths, schemas, and non-symlink files. |