Skip to content

fix(device): report a Gestures2 thumb wheel only when it can be diverted - #2732

Open
4ni1ak wants to merge 1 commit into
AprilNEA:masterfrom
4ni1ak:fix/gesture-thumbwheel-divertable
Open

4ni1ak wants to merge 1 commit into
AprilNEA:masterfrom
4ni1ak:fix/gesture-thumbwheel-divertable

Conversation

@4ni1ak

@4ni1ak 4ni1ak commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Summary

On an MX Master over Bluetooth (046d:b01e, firmware MPM12.10), thumb wheel bindings still do nothing on 0.9.0 (#1388). The mouse has no 0x2150, so #2038's Gestures2 path applies. The probe set Capabilities::thumbwheel as soon as gesture 46 appeared in the 0x6501 descriptor table, without checking that the gesture can be diverted.

Capture reads the same descriptor, finds no divertable bit, and leaves the wheel native without logging anything. The GUI therefore offered thumb wheel settings that could never take effect, and the reporter's log only shows gesture_thumbwheel=false.

The probe now reports a Gestures2 thumb wheel only when firmware lets software divert gesture 46. Capture logs a warning when it skips one, so the next report shows why.

Making a non-divertable wheel bindable would mean taking its horizontal scroll from the OS input stream and tying it to this mouse. That is a different feature and is left out here.

Changes

  • openlogi-device:
    • inventory/features.rs: Capabilities::thumbwheel from Gestures2 requires a diversion index.
    • inventory/persist.rs: probe-cache schema 20 → 21, so cached snapshots that still claim the wheel are re-probed.
    • session/gesture/arm.rs: warn when gesture 46 is absent or not divertable.
  • openlogi-hidpp (feature/gestures2.rs): drop has_thumbwheel, which has no caller left.
  • openlogi-core (device.rs): the thumbwheel doc says the Gestures2 wheel must be divertable.
  • docs/CONFIGURATION.md: explains when the MX Master and MX Master 2S thumb wheel can be bound.

Testing

  • cargo fmt --all -- --check
  • cargo test -p openlogi-device --lib: all passed.
    • New test gestures2_thumb_wheel_counts_only_when_it_can_be_diverted probes a scripted device whose gesture 46 descriptor has flags 0x83 (divertable) and 0x81 (not divertable).
    • Counter-proof: with the old is_some() check restored, the test fails on 0x81.
  • cargo clippy -p openlogi-hidpp -p openlogi-device -p openlogi-core --all-targets -- -D warnings
  • The pre-push hook ran full-workspace clippy and rustdoc.

Not runtime-tested on hardware; I don't have an MX Master. The 0x81 flags in the test are an assumption. The reporter's diagnostics show gesture 46 present and never diverted, but not its raw descriptor byte.

To verify on an MX Master (b01e):

  1. Start the agent and open the mouse in the desktop app.
  2. With this change, the thumb wheel settings are gone and the wheel scrolls horizontally.
  3. On an MX Master (4041) over Unifying, the thumb wheel settings are still shown and bindings still work.

Refs #1388

The probe set Capabilities::thumbwheel as soon as gesture 46 appeared in the
0x6501 descriptor table. On an MX Master (b01e) the gesture is listed but not
divertable, so capture left it native without a log line while the GUI kept
offering thumb wheel settings that could never apply.

Require a diversion index in the probe, bump the probe-cache schema so cached
snapshots are re-probed, and warn when capture skips the wheel.
@greptile-apps

greptile-apps Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Confidence Score: 4/5RetriggerView in Greptile

[Medium impact] The change reaches thumb-wheel capability reporting and capture for mice using the older Gestures2 path.

The runtime change matches capture's existing limits, but the new test must satisfy the repository's explicit requirements before merging.

Findings

  1. P1 Probe test checks too little ▶

Summary

The probe now offers a Gestures2 thumb wheel only when gesture 46 has a diversion index.

  • Gestures2 thumb-wheel settings appear only when gesture 46 can be diverted.

Acknowledged limitations from 4ni1ak: the 0x81 hardware flags are assumed, not captured from the reported mouse; hardware testing was not performed. Binding a non-divertable wheel through OS input is explicitly outside this change.

Reviews (1) · Last reviewed commit: "fix(device): report a Gestures2 thumb wh..." · Reviewed by Greptile

Comment on lines +1196 to +1199
let channel = scripted_channel(raw).await;
let probe = probe_features(&channel, 0xff, None, None).await.0;
let caps = probe.capabilities().unwrap();
assert_eq!(caps.thumbwheel, supported, "flags {flags:02x}");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Probe test checks too little

Blocking. The new test awaits scripted_channel and probe_features without a test deadline, then checks only caps.thumbwheel. This violates the repository requirement that async tests time out with a clear failure message and assert the whole reading. A stalled probe lacks a clear test-level failure, while changes to other capabilities or completeness can pass unnoticed.

Wrap setup and probing in a timeout, then compare the expected capabilities and completeness for both flag values. The test code establishes these gaps; no runtime hang was reproduced.

Rule Used: Severity: medium. Every bug fix ships a regression test that fails without the fix, and the PR states the counter-proof (the reverted line or the killed mutant). A test that passes with the fix reverted is not a regression test: ask for inputs where ... (source)

@davidbudnick davidbudnick added area: hidpp HID++ protocol and device feature support platform: all Cross-platform issue type: bug Something is broken or behaves incorrectly labels Dec 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: hidpp HID++ protocol and device feature support 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