Skip to content

fix(hid): stop macOS from freezing the cursor while Bridge is open - #49

Merged
snekxs merged 1 commit into
mainfrom
fix/macos-hid-shared-open
Oct 26, 2026
Merged

snekxs merged 1 commit into
mainfrom
fix/macos-hid-shared-open

Conversation

@snekxs

@snekxs snekxs commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Problem

On macOS, with Bridge open, mice connect and every setting is available, but the mouse itself stops working (the cursor stops moving).

Cause

macOS seizes any HID device that is opened in exclusive mode, and exclusive is the default for both hidapi and node-hid on macOS. When one of the opened paths is the mouse's own pointer collection (the control-panel session opens every path of an interface, and reads each report descriptor by opening it), the system stops delivering that device's movement for as long as Bridge holds the handle.

Fix

  • Rust: enable hidapi's macos-shared-device feature, so every open_path is shared. This covers the control-panel HID session, descriptor reads, and the Pulsar and Delux drivers.
  • Node helper: pass { nonExclusive: true } to every node-hid open (adapter and the Attack Shark X11 path). node-hid ignores the flag on Windows and Linux.

Testing

  • New macOS test asserts hidapi opens non-exclusively. Verified it fails without the feature (hidapi reports exclusive by default) and passes with it.
  • New Node test asserts both adapter open paths request nonExclusive. Verified it fails with the option removed.
  • cargo test, cargo clippy --all-targets -- -D warnings, cargo fmt --check and npm test pass.
  • Not verified on hardware yet: that the cursor no longer freezes with a real mouse. The cause is established from hidapi/node-hid behavior, not from reproducing the freeze.

No version bump; this is meant for the next release.

Note

Fix macOS cursor freeze by opening HID devices non-exclusively

Enables the hidapi macos-shared-device feature so macOS HID devices use shared mode instead of seizing them. Adds a shared non-exclusive open-options constant and passes it to native handle opens in HidDeviceAdapter.open, plus the default X11 polling-rate opener. Covers both identity-verified and multi-endpoint open paths, with tests in automation.test.mjs and a macOS-only check in src/hid.rs. Risk: hidapi shared mode changes device open behavior on macOS; check the Cargo.toml feature flag and the open-options constant in hid-device-adapter.mjs.

Macroscope summarized f2e5380.

…es the cursor

macOS seizes any HID device opened in exclusive mode, which is hidapi's and node-hid's default there. When the opened interface is a mouse's pointer collection, the system stops delivering its movement for as long as Bridge holds it.

- enable hidapi's macos-shared-device feature, so every Rust open is shared
- open node-hid handles with { nonExclusive: true } (ignored on Windows and Linux)
- add regression tests on both sides
@coderabbitai

coderabbitai Bot commented Oct 26, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 21 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
Commits

Reviewing files that changed from the base of the PR and between 52024f7 and f2e5380.

Files selected for processing: 5
  • Cargo.toml
  • native-hid/src/attack-shark-x11.mjs
  • native-hid/src/automation.test.mjs
  • native-hid/src/hid-device-adapter.mjs
  • src/hid.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added type: bug PR title category: bug area: native Native bridge and platform services area: devices HID access and device drivers area: dependencies Dependency manifests and lockfiles labels Oct 26, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 26, 2026

Copy link
Copy Markdown

Approvability

Verdict: Approved at f2e5380

Macroscope's review found this PR approvable — This is a narrowly scoped HID bug fix that switches existing macOS device opens to shared/non-exclusive mode so the OS cursor driver remains active. The changed runtime paths are limited and covered by focused tests, with no schema or broader product-surface changes.

Notes:

  • Your repo's Minimum Blocking Severity is Off, so correctness findings do not automatically block approval.

You can add or adjust custom eligibility rules. Learn more.

@snekxs
snekxs merged commit 33e0993 into main Oct 26, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: dependencies Dependency manifests and lockfiles area: devices HID access and device drivers area: native Native bridge and platform services type: bug PR title category: bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant