fix(hid): capture a middle button the device declares as its gesture button - #1472
Open
f-o-s-s-b-i-t-e wants to merge 1 commit into
Open
f-o-s-s-b-i-t-e wants to merge 1 commit into
f-o-s-s-b-i-t-e wants to merge 1 commit into
Conversation
…button The MX Anywhere 2S reports its physical Middle Button (0x1b04 CID 0x0052) with the `Gesture Button Navigation` task instead of an ordinary middle click. OpenLogi only ever plain-diverted 0x0052, and macOS side gestures excluded Middle Click from HID++ capture, so the control was never diverted and its factory gesture behavior stayed active: pressing the button leaked the firmware action while the preserved `bindings.MiddleClick` direction map never ran. Request CID 0x0052 as a raw-XY gesture source when a preserved Middle Click map exists on macOS, and arm it only when the device's own control row carries a gesture-button task (0x00a9 `Gesture Button Navigation` or 0x00ad `Multi Platform Gesture Button`). Ordinary middle buttons keep the flags-based plain divert and the OS hook keeps dispatching the map as the fail-open owner, so a normal mouse is unaffected.
|
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
On the MX Anywhere 2S the physical button behind the wheel is HID++ CID
0x0052with theGesture Button Navigationtask — not an ordinary middle click. v0.8.5 preserves existing Middle Click gesture maps and keeps them editable, but the runtime never captured0x0052: the capture plan only plain-diverted it asButtonId::MiddleClickwhen the hook did not own it, and macOS routed gesture-mode Middle Click to the OS hook, which passes unattributed Bluetooth-direct presses through. The button therefore kept running its firmware gesture task (Mission Control) while the configured direction map could never dispatch.This routes
0x0052through the same device-owned raw-XY capture path as Back/Forward, armed only when the device's own control table declares a gesture-button task — an ordinary middle button never becomes a gesture source.Changes
openlogi-deviceGESTURE_BUTTON_TASK_IDS(0x00a9Gesture Button Navigation,0x00adMulti Platform Gesture Button) andCtrlIdInfo::is_gesture_button().CaptureSpec::divert_gesture_navigation: raw-XY requests armed only when the control is divertable, raw-XY capable, and carries one of those tasks. The decision is logged (gesture-navigation capture request cid=… task=… flags=… confirmed=…) so a mis-gated model is diagnosable from the agent log.openlogi-agent-corehidpp_middle_gesture_maps_for: on macOS, a preserved Middle Click map requests(0x0052, MiddleClick); the plan routes it to the task-gated list and merges the map intoside_gesture_bindingsso captured swipes dispatch like Back/Forward.0x0052task is0x003a(MX Master 3S, MX Vertical, …) keeps exactly its current behavior.0x00a9/0x00ad, refuses0x003a), capture-plan request / no-request cases, hook-fallback pin.Testing
Repository validation (Linux container, Rust 1.98; this branch changes no workspace-wide build input):
cargo fmt --all -- --checkRUSTFLAGS=-D warnings cargo clippy -p openlogi-device -p openlogi-hid -p openlogi-cli -p openlogi-agent -p openlogi-agent-core -p openlogi --all-targets -- -D warnings--target aarch64-apple-darwin, pluscargo checkforx86_64-apple-darwinon the changed cratesRUSTDOCFLAGS=-D warnings cargo doc -p openlogi-device -p openlogi-agent-core --no-deps --document-private-itemscargo test -p openlogi-device -p openlogi-hid -p openlogi-cli -p openlogi-agent -p openlogi-agent-core -p openlogityposwith the repo configThe GUI crates were not built locally (no graphics toolchain in the container); CI covers them. Not runtime-tested on Linux, Windows, or a receiver-attached device.
Hardware verification (reporter's device, not a maintainer test): MX Anywhere 2S, Bluetooth-direct,
unit:e6c912de, macOS 15.7.9 x86_64.control capture active … gesture_buttons=0, no gesture dispatch lines at all.How to test:
0x0052with a gesture task (openlogi diag controls), with a preservedbindings.MiddleClickmap.OPENLOGI_LOG=openlogi_device=debug,openlogi_agent_core=debug.confirmed=trueandgesture_buttons=1; click and hold+direction now run the map, and the factory action is gone.0x0052task is0x003a, the same config must logconfirmed=falseand leave the middle button on the OS-hook path.Related to #946, #1356; sibling of #1385 (M720,
0x00d0/task0x00ad) — the predicate added here could later replace that PR's model-key gate, but this PR does not change the M720 path, nor the GUI's Middle Click eligibility policy (#1410), nor ordinary middle buttons (#560/#1262).Fixes #1471