Repository navigation
fix(hid): stop macOS from freezing the cursor while Bridge is open - #49
Conversation
…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
|
Warning Review limit reachedYou'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. View limit details
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. Comment |
ApprovabilityVerdict: Approved at 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:
You can add or adjust custom eligibility rules. Learn more. |
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
macos-shared-devicefeature, so everyopen_pathis shared. This covers the control-panel HID session, descriptor reads, and the Pulsar and Delux drivers.{ nonExclusive: true }to every node-hid open (adapter and the Attack Shark X11 path). node-hid ignores the flag on Windows and Linux.Testing
nonExclusive. Verified it fails with the option removed.cargo test,cargo clippy --all-targets -- -D warnings,cargo fmt --checkandnpm testpass.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-devicefeature 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 inHidDeviceAdapter.open, plus the default X11 polling-rate opener. Covers both identity-verified and multi-endpoint open paths, with tests inautomation.test.mjsand a macOS-only check insrc/hid.rs. Risk: hidapi shared mode changes device open behavior on macOS; check theCargo.tomlfeature flag and the open-options constant inhid-device-adapter.mjs.Macroscope summarized f2e5380.