fix(hid): support 0x1001 BatteryVoltage in diag battery (#688) - #741
Open
Liyfez wants to merge 1 commit into
Open
fix(hid): support 0x1001 BatteryVoltage in diag battery (#688)#741Liyfez wants to merge 1 commit into
Liyfez wants to merge 1 commit into
Conversation
- Update ead_battery_raw in openlogi-hid to probe
Greptile SummaryThis PR extends the raw battery diagnostic to support HID++
Confidence Score: 5/5The PR appears safe to merge with no actionable correctness or security issues identified. The new device filter, feature-probing fallback, typed BatteryVoltage decode, and scripted protocol responses are consistent with the existing HID++ abstractions and preserve the established preference for richer battery features.
|
| Filename | Overview |
|---|---|
| crates/openlogi-hid/src/write/diagnostics.rs | Refactors raw battery reads into a testable helper and adds a correctly typed 0x1001 fallback after the existing preferred features. |
| crates/openlogi-hid/src/write/tests.rs | Adds scripted coverage matching the HID++ function indices and payload layouts for all supported battery-report variants. |
| crates/openlogi-cli/src/cmd/diag/battery.rs | Expands device filtering and documentation so 0x1001-only devices can run the battery diagnostic. |
| crates/openlogi-cli/src/cmd/diag.rs | Updates command help to advertise all three supported battery-report formats. |
Sequence Diagram
sequenceDiagram
participant CLI as openlogi diag battery
participant Selector as Device selector
participant HID as Battery diagnostic
participant Device as HID++ device
CLI->>Selector: Find device with 0x1000, 0x1001, or 0x1004
Selector-->>CLI: Device route
CLI->>HID: read_battery_raw(route)
HID->>Device: Probe 0x1004 UnifiedBattery
alt 0x1004 supported
Device-->>HID: Percentage, level, status
else unsupported
HID->>Device: Probe 0x1000 BatteryStatus
alt 0x1000 supported
Device-->>HID: Discharge level, next level, status
else unsupported
HID->>Device: Probe 0x1001 BatteryVoltage
Device-->>HID: Voltage, status, critical
end
end
HID-->>CLI: Formatted raw report
Reviews (1): Last reviewed commit: "fix(hid): support 0x1001 BatteryVoltage ..." | 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.
Fixes #688
type: bugarea: hidplatform: allSummary of Changes
read_battery_rawinopenlogi-hidto probe0x1001 BatteryVoltagewhen neither0x1004 UnifiedBatterynor0x1000 BatteryStatusis exposed by the device.0x1001inopenlogi diag battery's candidate device filter list (openlogi-cli).0x1001fields (voltage_mv,status,critical).crates/openlogi-hid/src/write/tests.rswithScriptedRawHidChannelverifying raw diagnostic output for0x1004,0x1000,0x1001, and the unsupported fallback error.Testing
cargo fmt --all -- --checkpassed.cargo clippy --workspace --all-targets -- -D warningspassed with 0 warnings.cargo test --workspacepassed all test suites (includingopenlogi-hid,openlogi-cli,openlogi-uilocale parity, andopenlogi-ipcwire format tests).