Added SDL_HINT_HIDAPI_ENUMERATE_ONLY_CONTROLLERS to control whether SDL_hid_enumerate() enumerates all HID devices or only controllers.

By default SDL will only enumerate controllers, to reduce risk of hanging or crashing on devices with bad drivers and avoiding macOS keyboard capture permission prompts.
This commit is contained in:
Sam Lantinga
2023-05-27 09:37:38 -07:00
parent 77e59d4fa9
commit 0ffeca8a1c
10 changed files with 66 additions and 89 deletions

View File

@@ -1074,7 +1074,7 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
const hid_device_info *info = pDevice->GetDeviceInfo();
/* See if there are any devices we should skip in enumeration */
if (SDL_HIDAPI_ShouldIgnoreDevice(info->vendor_id, info->product_id)) {
if (SDL_HIDAPI_ShouldIgnoreDevice(info->vendor_id, info->product_id, 0, 0)) {
continue;
}