Skip to content

macOS: potential race with initially-connected devices #362

Description

@micolous

Related to #315

Unlike other backends (like Linux), the macOS backend only sends single "device connected" events, and doesn't seem to indicate when there are initially-connected devices.

When the CFRunLoop starts, IOHIDManager sends a DeviceMatching event for every already-connected device, one-by-one. If there are multiple devices, this could cause a race condition in DeviceSelector if IOHIDManager is slow to notify, as DeviceSelector would treat it as if there is exactly one device connected.

Monitor::start should call IOHIDManagerCopyDevices to get all the connected devices immediately, and fire a DevicesAdded event like Linux does.

I have a patch for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions