Module: wine Branch: master Commit: 3985b7c599cd0036eb4e2aef14e1cf7cbb7ffdb7 URL: https://gitlab.winehq.org/wine/wine/-/commit/3985b7c599cd0036eb4e2aef14e1cf7...
Author: Tim Clem tclem@codeweavers.com Date: Tue Feb 6 09:40:07 2024 -0800
winebus.sys: Do not attempt to open keyboard and mouse HID devices on macOS.
Doing so triggers a permissions prompt for input monitoring.
Patch originally by RĂ©mi Bernon.
---
dlls/winebus.sys/bus_iohid.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index 7c8c3cc3529..fdcd820e99e 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -276,6 +276,16 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void * }; struct iohid_device *impl; CFStringRef str; + UINT usage_page, usage; + + usage_page = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDPrimaryUsagePageKey))); + usage = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDPrimaryUsageKey))); + + if (usage_page == HID_USAGE_PAGE_GENERIC && (usage == HID_USAGE_GENERIC_MOUSE || usage == HID_USAGE_GENERIC_KEYBOARD)) + { + TRACE("Ignoring mouse / keyboard device\n"); + return; + }
desc.vid = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDVendorIDKey))); desc.pid = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDProductIDKey)));