https://bugs.winehq.org/show_bug.cgi?id=50153
Bug ID: 50153 Summary: HID doesn't work on macOS Catalina and Big Sur unless "Input Monitoring" permission is granted Product: Wine Version: 5.22 Hardware: x86-64 OS: Mac OS X Status: UNCONFIRMED Severity: normal Priority: P2 Component: hid Assignee: wine-bugs@winehq.org Reporter: bshanks@codeweavers.com
On macOS Catalina and Big Sur, if the user-level app (usually Terminal) doesn't have permission granted for "Input Monitoring" in System Preferences -> Security & Privacy, the IOHID support in winebus will fail with 'Couldn't open IOHIDManager.'. And when Wine is quitting and the driver unloads, it tries to call the IOHIDManager that was already released, causing a crash.
IOHIDManagerOpen() is failing with kIOReturnNotPermitted because it actually tries to "open" every matching device, which is every HID device on the system, including the keyboard (which requires Input Monitoring permission). (Yes, this API design is very confusing, and poorly documented).
Better is to open individual devices instead, so even if the keyboard fails to open other devices will still work.
Also it would be ideal to not "open" a device until it's necessary, so there won't be a permission prompt unless a Windows app actually wants to read from the keyboard. Currently some part of Wine's HID stack requests input reports when the device gets enumerated, triggering the permission prompt.