mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-11 17:05:41 +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:
parent
77e59d4fa9
commit
0ffeca8a1c
10 changed files with 66 additions and 89 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue