fix(gui): resolve assets for HID++ 1.0 Unifying devices via WPID fallback - #751
fix(gui): resolve assets for HID++ 1.0 Unifying devices via WPID fallback#751luisfacarmo wants to merge 4 commits into
Conversation
…back
Devices using HID++ 1.0 (many Unifying keyboards like K540/K545, K375s,
etc.) report model_info with all-zero model_ids because they lack feature
0x0003. The normal asset resolution path fails for these since neither the
strict nor suffix candidates match the registry.
This commit adds a WPID-based fallback: when the normal resolve() returns
None and the device has a WPID, try resolve_by_wpid() which formats the
WPID as a 4-hex suffix and matches it against the asset registry's modelId.
This works because the Unifying WPID IS the eQuad transport PID.
Additionally, persist_identities() now guards against identity downgrade:
a resolved display name (e.g. "K540/K545") cannot be overwritten by a
fallback name ("Slot 3") when the asset resolver temporarily fails.
Tested on hardware: Logitech K540/K545 (wpid 0x4076) via Unifying receiver
on Debian 13 Trixie. The device correctly shows its product name and
front.png asset across multiple inventory refresh cycles.
Fixes devices that have assets in the registry but were showing as
"Slot N" or "Unknown device" due to HID++ 1.0 limitations.
Greptile SummaryThis PR adds WPID-based asset resolution for HID++ 1.0 devices and protects resolved device identities from transient fallback values. The attempted receiver-slot reuse fix remains incomplete because the matching guard discards the available WPID before deciding that an unidentified replacement is the previous product.
Confidence Score: 4/5The PR is not yet safe to merge because a same-kind device re-paired into an existing receiver slot can still inherit the previous occupant's identity when codename and model information are unavailable. The new guard defaults to treating an unidentified same-kind slot occupant as the prior product while omitting the live WPID discriminator, leaving the previously reported stale identity, artwork, and capability metadata reachable. Files Needing Attention: crates/openlogi-desktop/src/state/inventory.rs and crates/openlogi-desktop/src/state/devices.rs
|
| Filename | Overview |
|---|---|
| crates/openlogi-desktop/src/services/assets.rs | Adds WPID-suffix and codename asset resolution for devices lacking usable HID++ model information. |
| crates/openlogi-desktop/src/state/devices.rs | Integrates WPID asset fallback and persisted-name reuse, but the identity check cannot use WPID when other model clues are absent. |
| crates/openlogi-desktop/src/state/inventory.rs | Adds anti-downgrade persistence, but its no-discriminator branch still preserves stale identity after same-kind receiver-slot replacement. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Receiver slot inventory] --> B{Asset resolves by model or WPID?}
B -->|Yes| C[Build resolved identity]
B -->|No| D[Build fallback identity]
D --> E{Codename or model_info distinguishes occupant?}
E -->|Yes, different| F[Replace persisted identity]
E -->|No evidence| G[Preserve previous slot identity]
G --> H[Replacement can show stale product metadata]
Reviews (5): Last reviewed commit: "fix(gui): scope anti-downgrade guard to ..." | Re-trigger Greptile
Address review feedback: when a Unifying/Bolt slot is re-paired with a different device type (e.g. keyboard replaced by mouse), the anti-downgrade guard must not preserve the previous occupant's identity. Adding a kind check ensures the guard only fires when the device classification matches, so a re-pairing correctly starts fresh.
…ce kind The identity-preservation guards in persist_identities() and the display-name fallback in build_device_list() previously used only DeviceKind as the discriminator to decide whether a persisted identity should carry over. This allowed a same-kind re-pair (e.g. swapping one mouse for another in the same receiver slot) to inherit the old device's display name, capabilities, and model metadata. Strengthen both checks: compare codename and model_info.config_key() when available, so a different product model paired into the same slot is correctly detected as a re-pairing. When no model-level identifiers are available on either side, the conservative kind-only fallback is retained (no regression for devices that never expose richer metadata).
70b3e6d to
d85a266
Compare
| // same device (the guard stays active). This matches the pre-existing | ||
| // kind-only behaviour for the corner case where neither side has any | ||
| // model-level identifiers at all. | ||
| true |
There was a problem hiding this comment.
Receiver-slot identity remains stale
When a same-kind device is re-paired into an existing receiver slot without a codename or model_info, same_model_identity treats the absence of contradictory evidence as a match even when the live pairing record has a different WPID. The guard then preserves the previous occupant's display name, model metadata, capabilities, and registry identity until another discriminator becomes available.
Knowledge Base Used:
Summary
HID++ 1.0 Unifying devices (many keyboards like K540/K545, K375s, etc.) report
DeviceModelInfowith all-zeromodel_idsbecause they lack feature 0x0003. The normal asset resolution path fails for these since neither the strict nor suffix candidates match the registry — even though the registry contains their assets keyed by WPID.Changes
crates/openlogi-desktop/src/services/assets.rsresolve_by_wpid()method onAssetResolverthat formats the WPID as a 4-hex suffix and matches against the registry viafind_by_model_id_suffix. Falls back to codename/displayName matching.crates/openlogi-desktop/src/state/devices.rsbuild_device_list(): whencache.resolve(model, codename)returnsNone, fall back tocache.resolve_by_wpid(paired.wpid, paired.codename). This covers the case wheremodel_infoisSomebut contains all-zero IDs.crates/openlogi-desktop/src/state/inventory.rspersist_identities(): a resolved identity (one with a real product name) cannot be overwritten by a fallback identity ("Slot 3") when the resolver temporarily fails.identity_is_resolved()andis_fallback_display_name()helpers.Testing
Tested on real hardware: Logitech K540/K545 (WPID
0x4076) via Unifying receiver on Debian 13 Trixie.front.pngasset in carousel and detail viewHow to test on hardware:
OPENLOGI_LOG=debug openlogi list— should showwpid=4076for the keyboardFixes #(new issue — HID++ 1.0 Unifying devices show as "Slot N" despite having assets in the registry)