feat: wire up ModeStatus (0x8090) performance/endurance switching - #1201
Open
007hacky007 wants to merge 14 commits into
Open
feat: wire up ModeStatus (0x8090) performance/endurance switching#1201007hacky007 wants to merge 14 commits into
007hacky007 wants to merge 14 commits into
Conversation
Greptile SummaryThe PR wires HID++ ModeStatus power-mode support through the device, IPC, agent, desktop, and CLI layers.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| crates/openlogi-cli/src/cmd/diag/power_mode.rs | Adds read, set, toggle, confirming read, and verified restoration flows for the power-mode diagnostic. |
| crates/openlogi-device/src/write/power_mode.rs | Implements device-facing ModeStatus reads and changed-mask-scoped writes. |
| crates/openlogi-hidpp/src/feature/mode_status.rs | Extends the ModeStatus protocol wrapper with event decoding and write support. |
| crates/openlogi-ipc/src/ipc.rs | Adds versioned power-mode read and write RPC methods. |
| crates/openlogi-desktop/src/state/power_mode.rs | Adds optimistic power-mode state updates followed by device-confirming reads. |
| crates/openlogi-desktop/src/features/pointer/power_mode.rs | Adds the Pointer-tab performance-mode control and capability-based disabled state. |
Sequence Diagram
sequenceDiagram
participant UI as Desktop / CLI
participant IPC as Agent IPC
participant Agent as Agent
participant HID as HID++ ModeStatus
UI->>IPC: ReadPowerMode / SetPowerMode
IPC->>Agent: Route request to device runner
Agent->>HID: getDevConfig / getModeStatus / setModeStatus
HID-->>Agent: Mode and switch capabilities
Agent-->>IPC: PowerModeState
IPC-->>UI: Render or verify selected mode
Reviews (3): Last reviewed commit: "fix(cli): verify the power-mode restore ..." | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wires the existing
ModeStatusFeature(HID++0x8090, performance/endurance power mode) end to end, per the plan in #1193: the driver decodes the mode-change event, the agent serves read/write RPCs, the GUI gets a Performance-mode toggle on the Pointer tab, and the CLI gets adiag power-moderound-trip. All protocol behavior follows the G305 measurements in the issue:status0bit 0,changed_mask0-only writes (a set touchingchanged_mask1answersInvalidArgument),getDevConfiggating, and the01 00 01/00 00 01event-0 broadcasts.Changes
ModeStatusFeaturegains anEventSource<ModeStatusEvent>plus a publicModeStatusEvent::decodeshim (same shape asunified_battery); payload layout is marked reverse-engineered from G305 captures.hid::mode_statusmodule with the IPC-facingPowerMode/PowerModeState;HidppOperationgainsReadPowerMode/WritePowerMode(appended, wire-safe).write/power_mode.rswithget_power_mode(_on)/set_power_mode(_on)(writes onlychanged_mask0), host-facade wrappers, and scripted-channel tests asserting the exact set bytes01 00 01 00.read_power_mode/set_power_modeappended to the trait,PROTOCOL_VERSION29 -> 30, wire-format goldens extended (request variants0x1a/0x1b, result encoding pinned).Load::Unsupporteddegradation, noCapabilitieschurn). The toggle disables whengetDevConfigreports no software switch. Writes are optimistic with a confirming re-read; the resolved value is never persisted because the device keeps the mode across power cycles itself (verified in the issue) - deliberately noconfig.tomlsurface. Reads re-arm on selection/inventory changes, so every reconnect re-reads the mode as the issue recommends.[pointer]keys across all 23 catalogs (best-effort translations; happy to take corrections).openlogi diag power-mode- read -> toggle -> read-back -> restore,--set performance|enduranceto leave a mode applied,--devicefilter; device auto-selection keys on feature0x8090.diag power-modeline in USAGE.md.The last commit fixes a pre-existing
get_device_configbyte-order bug the hardware run exposed (details under Testing).Deliberate scope cuts (can follow up if wanted): no agent-side event consumption yet (the driver decode + shim make that a small follow-up in
inventory/events.rs), no bindable button action, no report-rate UI interplay (OpenLogi does not wire0x8060today).Screenshot
The card on a real G305 (Pointer tab, macOS), served by the agent over the new RPCs - endurance active, toggle live, with the macOS pointer-speed note:
Testing
cargo test -p openlogi-hidpp(event decode: post-set01 00 01, power-on00 00 01, non-zero function rejected)cargo test -p openlogi-device(scripted-channel read + exact write bytes)cargo test -p openlogi-ipc --test wire_format(new goldens + pinned v30)cargo test -p openlogi-ui localeandcargo test -p openlogi-desktop i18n(23-catalog parity)cargo fmt --all -- --check,cargo clippy --workspace --all-targets -- -D warnings(RUSTFLAGS="-D warnings"),cargo test --workspace, non-GUI rustdoc,typos --config .config/typos.toml .cargo-deny, MSRV matrix, Linux/Windows clippy (no toolchains on this host)openlogi-agent-mock, and against the real agent + G305 over the receiver - the screenshot above is live hardware, read through the newread_power_modeRPCopenlogi diag power-moderound-trip passes - reads Endurance, toggles to Performance, reads it back, restores Endurance. It also caught a latent driver bug on the first run:get_device_configdecoded the capability bytes big-endian, shifting the G305's0x02(software switch) into the high byte and reporting no capabilities at all - which would have greyed out the GUI toggle on the exact device this feature targets. Fixed to read the byte the device answers (little-endian; the scripted fixture now mirrors the real reply) and re-verified: the diag reportssoftware_switch=true hardware_switch=false, matching the issue's capture.Field observation worth documenting: with macOS pointer acceleration enabled, switching to performance (report rate 8 ms -> 1 ms) makes the cursor feel slower at the same DPI - per-report deltas are 8x smaller and the OS acceleration curve gives small deltas less gain. Verified the sensor DPI itself is untouched by the mode switch (read 4400 in both modes on the G305). Not an OpenLogi bug, but it is the first thing a tester notices, so the card now carries a macOS-only caption explaining it (new
pointer.power_mode_macos_pointer_notekey in all catalogs).Fixes #1193