Allow Valve devices in driver check, we know they're well behaved controllers
authorSam Lantinga <slouken@libsdl.org>
Fri, 20 Mar 2020 21:05:07 -0700
changeset 13662d32d92e782ab
parent 13661 8a949642b6eb
child 13663 37af808e6222
Allow Valve devices in driver check, we know they're well behaved controllers
src/joystick/hidapi/SDL_hidapijoystick.c
     1.1 --- a/src/joystick/hidapi/SDL_hidapijoystick.c	Fri Mar 20 20:53:26 2020 -0700
     1.2 +++ b/src/joystick/hidapi/SDL_hidapijoystick.c	Fri Mar 20 21:05:07 2020 -0700
     1.3 @@ -427,11 +427,13 @@
     1.4      }
     1.5  #endif
     1.6  
     1.7 -    if (device->usage_page && device->usage_page != USAGE_PAGE_GENERIC_DESKTOP) {
     1.8 -        return NULL;
     1.9 -    }
    1.10 -    if (device->usage && device->usage != USAGE_JOYSTICK && device->usage != USAGE_GAMEPAD && device->usage != USAGE_MULTIAXISCONTROLLER) {
    1.11 -        return NULL;
    1.12 +	if (device->vendor_id != USB_VENDOR_VALVE) {
    1.13 +        if (device->usage_page && device->usage_page != USAGE_PAGE_GENERIC_DESKTOP) {
    1.14 +            return NULL;
    1.15 +        }
    1.16 +        if (device->usage && device->usage != USAGE_JOYSTICK && device->usage != USAGE_GAMEPAD && device->usage != USAGE_MULTIAXISCONTROLLER) {
    1.17 +            return NULL;
    1.18 +        }
    1.19      }
    1.20  
    1.21      type = SDL_GetJoystickGameControllerType(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol);