Complete typed HID++ feature wrappers#326
Conversation
Greptile SummaryThis PR completes typed HID++ 2.0 feature wrappers for all non-destructive features covered by
Confidence Score: 5/5Safe to merge; all write paths continue to apply a 4-zone cap and the SmartShift migration correctly handles the function-ID shift between 0x2110 and 0x2111. The migration preserves the behavioral contract of both lighting and SmartShift write paths. New feature wrappers are well-tested with representative unit tests. The only non-blocking concerns are a missing band-count cap in the Equalizer wrapper and the inherent ambiguity of using a hardcoded zone-effect index for the lighting path — both acknowledged in the PR notes. crates/openlogi-hid/src/write/lighting.rs (hardcoded zone-effect index needs real-device validation) and crates/openlogi-hidpp/src/feature/equalizer/mod.rs (band-count cap). Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Agent: set_keyboard_color] --> B{LightingMethod?}
B -->|Auto / ColorLedEffects| C[set_color_effects]
B -->|PerKey| D[set_color_per_key]
C --> E[open_feature ColorLedEffectsFeature 0x8070]
E --> F[get_info zone_count]
F --> G{zone_count == 0?}
G -->|yes| H[fallback: zones_to_write = 4]
G -->|no| I[zones_to_write = zone_count.min 4]
H --> J[loop: set_zone_effect EFFECT_FIXED Volatile]
I --> J
J --> K[sleep FRAME_GAP 8ms per zone]
D --> L[resolve_feature_index 0x8080]
L --> M[raw HID++ writes]
N[Agent: set_smartshift] --> O[SmartShift::open]
O --> P{0x2111 present?}
P -->|yes| Q[SmartShiftEnhancedFeature]
P -->|no| R[SmartShiftFeature 0x2110]
Q --> S[set_ratchet_control_mode]
R --> T[set_ratchet_control_mode]
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[Agent: set_keyboard_color] --> B{LightingMethod?}
B -->|Auto / ColorLedEffects| C[set_color_effects]
B -->|PerKey| D[set_color_per_key]
C --> E[open_feature ColorLedEffectsFeature 0x8070]
E --> F[get_info zone_count]
F --> G{zone_count == 0?}
G -->|yes| H[fallback: zones_to_write = 4]
G -->|no| I[zones_to_write = zone_count.min 4]
H --> J[loop: set_zone_effect EFFECT_FIXED Volatile]
I --> J
J --> K[sleep FRAME_GAP 8ms per zone]
D --> L[resolve_feature_index 0x8080]
L --> M[raw HID++ writes]
N[Agent: set_smartshift] --> O[SmartShift::open]
O --> P{0x2111 present?}
P -->|yes| Q[SmartShiftEnhancedFeature]
P -->|no| R[SmartShiftFeature 0x2110]
Q --> S[set_ratchet_control_mode]
R --> T[set_ratchet_control_mode]
Reviews (4): Last reviewed commit: "fix(hidpp): correct multi-host fn invers..." | Re-trigger Greptile |
Summary
Completes typed HID++ wrappers for all documented non-destructive features currently covered by
hidpp-docsand wires the HID crate to use the new wrappers where appropriate.Highlights:
0x1b04ReprogControls V4/V6ControlIdandTaskIdconstant tables.Validation
cargo fmt --checkcargo test -p openlogi-hidpp --libcargo clippy -p openlogi-hidpp --all-targets -- -D warningscargo check -p openlogi-hidcargo clippy -p openlogi-hid --all-targets -- -D warningsNotes
Intentionally not included:
Hardware follow-up: the
0x8070lighting write migration still needs real-device validation to confirm target firmware ACK behavior for typedsend_v20calls.