mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-05-14 15:42:49 +02:00
Added SDL_HINT_HIDAPI_IGNORE_DEVICES to specify devices that should be ignored in SDL_hid_enumerate()
This commit is contained in:
@@ -836,7 +836,18 @@ int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock)
|
||||
struct hid_device_info HID_API_EXPORT *hid_enumerate(unsigned short vendor_id, unsigned short product_id)
|
||||
{ @autoreleasepool {
|
||||
struct hid_device_info *root = NULL;
|
||||
|
||||
const char *hint = SDL_GetHint(SDL_HINT_HIDAPI_IGNORE_DEVICES);
|
||||
|
||||
/* See if there are any devices we should skip in enumeration */
|
||||
if (hint) {
|
||||
char vendor_match[16], product_match[16];
|
||||
SDL_snprintf(vendor_match, sizeof(vendor_match), "0x%.4x/0x0000", VALVE_USB_VID);
|
||||
SDL_snprintf(product_match, sizeof(product_match), "0x%.4x/0x%.4x", VALVE_USB_VID, D0G_BLE2_PID);
|
||||
if (SDL_strcasestr(hint, vendor_match) || SDL_strcasestr(hint, product_match)) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ( vendor_id == 0 && product_id == 0 ) ||
|
||||
( vendor_id == VALVE_USB_VID && product_id == D0G_BLE2_PID ) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user