Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(hid): solid keyboard colour via 0x8070 effect#205

Open
davidbudnick wants to merge 2 commits into
AprilNEA:master from
davidbudnick:fix/keyboard-mouse-lighting
Open

fix(hid): solid keyboard colour via 0x8070 effect #205
davidbudnick wants to merge 2 commits into
AprilNEA:master from
davidbudnick:fix/keyboard-mouse-lighting

Conversation

@davidbudnick

@davidbudnick davidbudnick commented Jun 10, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Context

  • keyboard wouldn't hold a solid colour — per-key 0x8080 can't override the G-series onboard effect
  • so set_keyboard_color now prefers 0x8070 ColorLedEffects (fixed effect, RAM-only), falls back to 0x8080
  • lighting tab now shows for keyboards exposing either 0x8070 or 0x8080

Testing

  • set red/green/blue on a wired G513 via openlogi diag lighting — solid, confirmed on hardware
  • cargo test + clippy + fmt clean

Screen

Screenshot 2026年06月10日 at 2 42 22 PM Screenshot 2026年06月10日 at 2 42 26 PM Screenshot 2026年06月10日 at 2 42 30 PM

greptile-apps[bot] reacted with thumbs up emoji

greptile-apps Bot commented Jun 10, 2026
edited
Loading

Copy link
Copy Markdown

Greptile Summary

This PR fixes solid-colour keyboard lighting on G-series keyboards by switching from the PerKeyLighting (0x8080) per-key stream — which the onboard firmware can silently override — to the ColorLedEffects (0x8070) effect engine, which replaces the running onboard profile. A clean fallback to 0x8080 covers devices that expose no effect engine.

  • Adds LightingMethod (Auto/Effects/PerKey), set_keyboard_color_with(), and the private set_color_effects() helper that writes a fixed RAM-only effect to each zone with 8 ms inter-packet pacing; set_keyboard_color() becomes a thin Auto delegate.
  • Extends the LIGHTING capabilities array to include 0x8070 so keyboards that expose ColorLedEffects (but not 0x8080) correctly show a Lighting tab in the GUI.
  • Wires a --method flag into openlogi diag lighting for explicit A/B comparison; hardware-verified on a wired G513.

Confidence Score: 5/5

Safe to merge — the change is hardware-verified, the fallback path is correct, and existing callers of set_keyboard_color() are unaffected.

The Auto fallback correctly distinguishes a missing 0x8070 feature from any other error before falling through to 0x8080. Packet layout for the 0x8070 path is consistent with the HID++ 2.0 long-report structure, and the RAM-only persistence byte is the zero value so its exact offset is inconsequential. No callers are broken by the refactor.

crates/openlogi-cli/src/cmd/diag/lighting.rs — module doc still references 0x8080 as the primary path.

Important Files Changed

Filename Overview
crates/openlogi-hid/src/write.rs Adds LightingMethod enum, set_keyboard_color_with(), resolve_feature_index(), set_color_effects() (0x8070), and extracts set_color_per_key() (0x8080). Auto fallback logic is correct; packet layouts and error propagation look sound.
crates/openlogi-core/src/device.rs Extends LIGHTING constant to include 0x8070 so keyboards that expose ColorLedEffects earn a Lighting tab; comment updated to match.
crates/openlogi-hid/src/lib.rs Re-exports LightingMethod and set_keyboard_color_with as new public surface; straightforward.
crates/openlogi-cli/src/cmd/diag/lighting.rs Adds --method CLI flag and routes to set_keyboard_color_with(); module doc comment still says 0x8080 rather than the new preferred 0x8070 path.

Sequence Diagram

sequenceDiagram
 participant CLI as diag lighting
 participant W as set_keyboard_color_with
 participant FI as resolve_feature_index
 participant E as set_color_effects (0x8070)
 participant PK as set_color_per_key (0x8080)
 participant HID as HID Device
 CLI->>W: "method=Auto, r, g, b"
 W->>E: r, g, b
 E->>FI: "feature_id=0x8070"
 FI->>HID: get_feature(0x8070)
 alt 0x8070 present
 HID-->>FI: feature index
 FI-->>E: Some(index)
 loop zones 0..4
 E->>HID: write_output_report (setZoneEffect, fixed, RAM-only)
 end
 E-->>W: Ok(())
 W-->>CLI: Ok(())
 else 0x8070 absent
 HID-->>FI: None
 FI-->>E: Ok(None)
 E-->>W: "Err(FeatureUnsupported{0x8070})"
 W->>PK: r, g, b (fallback)
 PK->>FI: "feature_id=0x8080"
 FI->>HID: get_feature(0x8080)
 HID-->>FI: feature index
 FI-->>PK: Some(index)
 loop key chunks
 PK->>HID: write_output_report (setGroupKeys)
 end
 PK->>HID: write_output_report (frameEnd)
 PK-->>W: Ok(())
 W-->>CLI: Ok(())
 end
Loading

Reviews (4): Last reviewed commit: "docs(hid): fix set_color_effects RAM-onl..." | Re-trigger Greptile

Comment thread crates/openlogi-hid/src/write.rs Outdated
@davidbudnick davidbudnick force-pushed the fix/keyboard-mouse-lighting branch from e954d33 to c216939 Compare June 13, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@greptile-apps greptile-apps[bot] greptile-apps[bot] left review comments

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

AltStyle によって変換されたページ (->オリジナル) /