feat(cli): report feature flags and firmware entities in diag features - #690
Open
yuzi-co wants to merge 1 commit into
Open
feat(cli): report feature flags and firmware entities in diag features#690yuzi-co wants to merge 1 commit into
yuzi-co wants to merge 1 commit into
Conversation
`openlogi diag features` printed a feature's ID and version and dropped
everything else the device said about it. Two things were missing, and
both are what a device report needs.
The feature table carries type flags that `FeatureEntry` discarded. A
G502 LIGHTSPEED reports 30 features, 16 of them flagged hidden or
engineering, and the dump gave no way to tell those apart from the ones
configuration software is meant to drive. When someone asks why OpenLogi
does not expose `0x1890`, the answer is in a flag we were not showing.
The device also lists its firmware entities through `0x0003` function 1:
the running application, the bootloader, and on many models a separate
radio stack. That is the version that explains why two people with the
same model see different behaviour, and it was not reachable from the
CLI at all.
An entity that does not parse is reported rather than dropped. The G502
declares three and its radio stack fails to decode, and a device that
cannot describe one of its own firmware images is worth seeing:
fw 0: Bootloader BOT92.00_B0008 pid=aaef
fw 1: MainApplication MPM17.00_B0008 pid=c08d [active]
fw 2: unreadable (UnsupportedResponse)
`FeatureType` and `DeviceEntityType` are now re-exported from
`openlogi-hid`. `FeatureEntry::typ` was already a `hidpp` type in the
public API with no way for a consumer to name it, so the CLI had been
reduced to testing raw bits.
Read-only throughout. Nothing here writes to a device.
Greptile SummaryThis PR expands
Confidence Score: 5/5The PR appears safe to merge, with no concrete changed-code defect identified. The new diagnostic reads are sequential, use the established route and feature-opening paths, iterate exactly the declared firmware entities, preserve per-entity failures, and have no incompatible repository consumer.
|
| Filename | Overview |
|---|---|
| crates/openlogi-cli/src/cmd/diag/features.rs | Displays feature flags and firmware entities, with formatter tests covering the newly introduced output states. |
| crates/openlogi-hid/src/write/diagnostics.rs | Preserves feature-type metadata and adds bounded, per-entity firmware reads that retain individual parsing failures. |
| crates/openlogi-hid/src/lib.rs | Re-exports the new diagnostic API and the HID++ types exposed by its public structures. |
| crates/openlogi-hid/src/write.rs | Publishes the firmware diagnostics types and function through the existing write-module API surface. |
Sequence Diagram
sequenceDiagram
participant CLI as openlogi diag features
participant HID as openlogi-hid
participant Device as HID++ device
CLI->>HID: dump_features(route)
HID->>Device: Read FeatureSet entries
Device-->>HID: IDs, versions, type flags
HID-->>CLI: "Vec<FeatureEntry>"
CLI->>HID: dump_firmware_entities(route)
HID->>Device: Read DeviceInformation
Device-->>HID: entity_count
loop Every declared entity
HID->>Device: get_fw_info(index)
Device-->>HID: firmware record or error
end
HID-->>CLI: "Vec<FirmwareEntityEntry>"
CLI-->>CLI: Render flags and firmware lines
Reviews (1): Last reviewed commit: "feat(cli): report feature flags and firm..." | 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
openlogi diag featuresprinted a feature's ID and version and threw awayeverything else the device said. Two things were missing, and both are what a
device report needs to be actionable.
Feature type flags. The feature table carries obsolete / hidden /
engineering flags that
FeatureEntrywas discarding. On a G502 LIGHTSPEED, 16of its 30 features are flagged hidden or engineering, and the old dump gave no
way to tell those from the ones configuration software is meant to drive.
Firmware entities. A device lists its firmware through
0x0003function 1:the running application, the bootloader, and on many models a separate radio
stack. That version is what explains why two people with the same model see
different behaviour, and it was not reachable from the CLI at all.
Read-only throughout. Nothing here writes to a device.
Before / after
Same device, same command, wired G502 LIGHTSPEED:
Unreadable entities are reported, not dropped
The G502 declares three entities and its third fails to decode. Dropping the
row would claim the device has two firmware images when it says it has three,
so the entry carries the reason instead.
That third entity is the radio stack, and the decode failure is a real gap in
the vendored
hidppparser rather than a device quirk. Raw payload:get_fw_inforuns the build field throughbcd::convert_packed_u8, whichrejects
a9. Filed separately rather than fixed here, since it belongs in thevendored crate and has its own blast radius.
Changes
crates/openlogi-hidFeatureEntrygainstyp, the flags the device already sends alongside eachfeature;
dump_featuresstops discarding themFirmwareEntityEntryanddump_firmware_entities, reading every entitythe device declares and recording per-entity read failures rather than
aborting the whole call
FeatureTypeandDeviceEntityType.FeatureEntry::typis ahidpptype in the public API and a consumer previously had no way to nameit, which left the CLI testing raw bits
crates/openlogi-clidiag featuresprints aflagscolumn and the firmware entity linesformat_firmware_entityis a pure formatter with unit testsTesting
cargo fmt --all -- --check— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo test --workspace— clean, including 5 new tests forformat_firmware_entityRUSTDOCFLAGS="-D warnings" cargo doc -p openlogi-hid -p openlogi-hidpp -p openlogi-hidpp-derive --no-deps --document-private-items— fails on thepre-existing
AsyncHidChannel::supports_short_long_hidpplink inopenlogi-hid/src/transport.rs, which this PR does not touch and docs(hid): stop linking a cfg-gated type so rustdoc passes on Windows #661 fixes.Windows-local: the type is
cfg(not(windows)), so CI's Linux run passesLightspeed receiver and cabled. Output above is real, not constructed
Incidentally confirms #660 from the other direction: the same mouse gains
0x00c2and loses0x2121when you plug the cable in, 30 features either way.