Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow Valve devices in driver check, we know they're well behaved con…
…trollers
  • Loading branch information
slouken committed Mar 21, 2020
1 parent 6e646b6 commit f55cbdf
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/joystick/hidapi/SDL_hidapijoystick.c
Expand Up @@ -427,11 +427,13 @@ HIDAPI_GetDeviceDriver(SDL_HIDAPI_Device *device)
}
#endif

if (device->usage_page && device->usage_page != USAGE_PAGE_GENERIC_DESKTOP) {
return NULL;
}
if (device->usage && device->usage != USAGE_JOYSTICK && device->usage != USAGE_GAMEPAD && device->usage != USAGE_MULTIAXISCONTROLLER) {
return NULL;
if (device->vendor_id != USB_VENDOR_VALVE) {
if (device->usage_page && device->usage_page != USAGE_PAGE_GENERIC_DESKTOP) {
return NULL;
}
if (device->usage && device->usage != USAGE_JOYSTICK && device->usage != USAGE_GAMEPAD && device->usage != USAGE_MULTIAXISCONTROLLER) {
return NULL;
}
}

type = SDL_GetJoystickGameControllerType(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol);
Expand Down

0 comments on commit f55cbdf

Please sign in to comment.