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.
From: Tim Clem tclem@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);
This merge request was approved by Rémi Bernon.