mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-03 22:29:19 +00:00
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:
@@ -901,7 +901,13 @@ struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned shor
|
||||
|
||||
#ifdef HIDAPI_IGNORE_DEVICE
|
||||
/* See if there are any devices we should skip in enumeration */
|
||||
if (HIDAPI_IGNORE_DEVICE(attrib.VendorID, attrib.ProductID)) {
|
||||
PHIDP_PREPARSED_DATA pp_data = NULL;
|
||||
HIDP_CAPS caps = { 0 };
|
||||
if (HidD_GetPreparsedData(device_handle, &pp_data)) {
|
||||
HidP_GetCaps(pp_data, &caps);
|
||||
HidD_FreePreparsedData(pp_data);
|
||||
}
|
||||
if (HIDAPI_IGNORE_DEVICE(attrib.VendorID, attrib.ProductID, caps.UsagePage, caps.Usage)) {
|
||||
goto cont_close;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user