[PATCH v2 0/1] MR5208: winebus.sys: Only attempt to open joysticks and gamepads in the IOHID backend.
An extension of 3985b7c5. Opening the device for the Touch Bar on older MacBooks also triggers a permission prompt, so for now it makes sense to restrict the devices open. -- v2: winebus.sys: Only attempt to open joysticks and gamepads in the IOHID backend. https://gitlab.winehq.org/wine/wine/-/merge_requests/5208
From: Tim Clem <tclem(a)codeweavers.com> An extension of 3985b7c5. Opening the device for the Touch Bar on older MacBooks also triggers a permission prompt, so for now it makes sense to restrict the devices we open. --- dlls/winebus.sys/bus_iohid.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/dlls/winebus.sys/bus_iohid.c b/dlls/winebus.sys/bus_iohid.c index fdcd820e99e..a44944576e9 100644 --- a/dlls/winebus.sys/bus_iohid.c +++ b/dlls/winebus.sys/bus_iohid.c @@ -281,17 +281,22 @@ static void handle_DeviceMatchingCallback(void *context, IOReturn result, void * 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))); desc.version = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDVersionNumberKey))); desc.uid = CFNumberToDWORD(IOHIDDeviceGetProperty(IOHIDDevice, CFSTR(kIOHIDLocationIDKey))); + if (usage_page != HID_USAGE_PAGE_GENERIC || + !(usage == HID_USAGE_GENERIC_JOYSTICK || usage == HID_USAGE_GENERIC_GAMEPAD)) + { + /* winebus isn't currently meant to handle anything but these, and + * opening keyboards, mice, or the Touch Bar on older MacBooks triggers + * a permissions dialog for input monitoring. + */ + ERR("Ignoring HID device %p (vid %04x, pid %04x): not a joystick or gamepad\n", IOHIDDevice, desc.vid, desc.pid); + return; + } + if (IOHIDDeviceOpen(IOHIDDevice, 0) != kIOReturnSuccess) { ERR("Failed to open HID device %p (vid %04x, pid %04x)\n", IOHIDDevice, desc.vid, desc.pid); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/5208
This merge request was approved by Rémi Bernon. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/5208
participants (3)
-
Rémi Bernon -
Tim Clem -
Tim Clem (@tclem)