Skip to content

fix(hid): show the 0x0005 device name when the receiver stores no codename - #286

Open
samsontands wants to merge 2 commits into
AprilNEA:masterfrom
samsontands:fix/device-name-fallback
Open

fix(hid): show the 0x0005 device name when the receiver stores no codename#286
samsontands wants to merge 2 commits into
AprilNEA:masterfrom
samsontands:fix/device-name-fallback

Conversation

@samsontands

Copy link
Copy Markdown

Problem

On a Unifying receiver, a fully-recognised device shows up as "Unknown device" in openlogi list (and the GUI device list). The display name (codename) is read only from the receiver's stored codename register (read_codename), which a Unifying receiver doesn't populate per slot — so it is always None there, and some Bolt pairings lack it too.

Fix

The slot probe already creates the HID++ 0x0005 (DeviceTypeAndName) feature to read the device kind. This change also reads the device's marketing name via get_whole_device_name() and uses it as the codename fallback only when the receiver register returns none. When a stored codename exists, behavior is unchanged.

Touched: crates/openlogi-hid/src/inventory.rsProbedFeatures gains a name field, populated in probe_features; probe_unifying_slot and probe_bolt_slot use codename.or_else(|| probe.name.clone()).

Verification

Original MX Master (reports Wireless Mouse MX Master, wpid 4060) over a Unifying receiver, macOS 26:

Before:

slot 1 ● Unknown device (mouse, wpid=4060, ...)

After:

slot 1 ● Wireless Mouse MX Master (mouse, wpid=4060, ...)

cargo fmt -p openlogi-hid -- --check, cargo clippy -p openlogi-hid --all-targets -- -D warnings, and cargo test -p openlogi-hid (61 passed) are all clean.

Notes

  • Adds a short Tested devices section to the README documenting the MX Master result.
  • Generic HID++ control on this device (DPI 0x2201, SmartShift 0x2110, and Back/Forward/mode-shift remapping) already works — this PR is purely about the display name.

🤖 Generated with Claude Code

@greptile-apps

greptile-apps Bot commented Jun 18, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes devices connected via a Unifying receiver (and some Bolt pairings) showing as "Unknown device" by reading the device's own marketing name from HID++ feature 0x0005 (DeviceTypeAndName) and using it as a codename fallback when the receiver's stored codename register returns None.

  • Adds a name: Option<String> field to ProbedFeatures, populated via get_whole_device_name() only on the Bolt/Unifying probe paths (want_name = true); the direct path skips it (want_name = false) to avoid wasteful round-trips since info.name already serves as the codename there.
  • Threads the want_name flag through probe_or_reuseprobe_features, and applies the fallback in both probe_unifying_slot and walk_bolt_slot via codename.or_else(|| probe.name.clone()).

Confidence Score: 5/5

Safe to merge — the change is purely additive, touching only the codename fallback on the Bolt/Unifying paths, with no risk of overriding an existing stored codename.

The want_name flag correctly gates the extra HID++ round-trip so the direct path is unaffected. The or_else fallback fires only when the receiver register returns None, leaving existing behaviour unchanged when a codename is present. The name field is cached as part of ProbedFeatures alongside the other immutable device data, so cache hits carry it forward correctly.

Files Needing Attention: No files require special attention.

Important Files Changed

Filename Overview
crates/openlogi-hid/src/inventory/features.rs Adds name: Option<String> to ProbedFeatures and reads it conditionally (want_name flag) from 0x0005 with proper trim/empty guard. Well-structured and correct.
crates/openlogi-hid/src/inventory/probe.rs Both Bolt and Unifying slot probes now fall back to probe.name when the receiver-stored codename is None; the direct path correctly passes want_name = false. Logic is clean and correctly scoped.
crates/openlogi-hid/src/inventory/cache.rs Adds want_name parameter to probe_or_reuse and threads it through to probe_features. Minimal, correct change; the cached ProbedFeatures now carries the name and it persists across cache hits normally.
README.md Adds a Tested devices table documenting the MX Master on a Unifying receiver.

Reviews (3): Last reviewed commit: "perf(hid): skip the 0x0005 name read on ..." | Re-trigger Greptile

Comment thread crates/openlogi-hid/src/inventory.rs Outdated
samsontands and others added 2 commits August 1, 2026 19:50
…ename

Unifying receivers (and some Bolt pairings) don't store a per-slot codename,
so a fully-recognised device showed up as "Unknown device" in `openlogi list`
and the GUI. The slot probe already reads HID++ 0x0005 for the device kind;
this also reads its marketing name via `get_whole_device_name()` and uses it
as the codename fallback when the receiver register has none. Behavior is
unchanged whenever a stored codename exists.

Verified on an original MX Master (reports "Wireless Mouse MX Master",
wpid 4060) over a Unifying receiver on macOS 26: `openlogi list` now shows the
model name instead of "Unknown device". Adds a Tested devices section to the
README.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`probe_features` is shared by the Bolt, Unifying, and direct paths. The
direct (BT/USB) path already uses the HID node name as the codename, so the
marketing-name read (`get_whole_device_name`, several HID++ round-trips for
long names) was fetched and then discarded there on every cache-miss probe.

Thread a `want_name` flag so only the Bolt/Unifying paths — which can lack a
stored codename — pay for it. The direct path passes `false`.

Addresses review feedback on AprilNEA#286.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@davidbudnick
davidbudnick force-pushed the fix/device-name-fallback branch from 079d82f to 7d4b9ec Compare August 2, 2026 00:51
@davidbudnick davidbudnick added platform: all Cross-platform issue type: bug Something is broken or behaves incorrectly labels Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: all Cross-platform issue type: bug Something is broken or behaves incorrectly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants