mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-01-10 07:13:20 +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:
@@ -974,7 +974,13 @@ struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id,
|
||||
if (!parse_hid_vid_pid_from_sysfs(sysfs_path, &bus_type, &dev_vid, &dev_pid))
|
||||
continue;
|
||||
|
||||
if (HIDAPI_IGNORE_DEVICE(dev_vid, dev_pid)) {
|
||||
struct hidraw_report_descriptor report_desc;
|
||||
unsigned short page = 0, usage = 0;
|
||||
unsigned int pos = 0;
|
||||
if (get_hid_report_descriptor_from_sysfs(sysfs_path, &report_desc) >= 0) {
|
||||
get_next_hid_usage(report_desc.value, report_desc.size, &pos, &page, &usage);
|
||||
}
|
||||
if (HIDAPI_IGNORE_DEVICE(dev_vid, dev_pid, page, usage)) {
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user