Skip to content

macOS: notify about already-connected devices at the same time#363

Open
micolous wants to merge 2 commits into
mozilla:ctap2-2021from
micolous:macos-initial-enumeration
Open

macOS: notify about already-connected devices at the same time#363
micolous wants to merge 2 commits into
mozilla:ctap2-2021from
micolous:macos-initial-enumeration

Conversation

@micolous

@micolous micolous commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Fixes #362, unblocks #315

This calls IOHIDManagerCopyDevices before starting the CFRunLoop for IOHIDManager, so that there is a single DevicesAdded event containing all already-connected devices, much like you'd get on Linux. If there are zero already-connected devices, then it sends DevicesAdded(vec![]).

This addresses a potential race condition if IOHIDManager is slow to notify about a device which is already connected.

IOHIDManager still calls DeviceMatchingCallback for every already-connected device once a CFRunLoop has started, so this also ignores duplicate events.

… and notify about all existing devices at the same time (mozilla#362)
Comment thread src/transport/macos/monitor.rs Outdated
Comment thread src/transport/macos/monitor.rs Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS: potential race with initially-connected devices

2 participants