Don't send k_ePS4FeatureReportIdCapabilities to Sony PS4 controllers

This report is for third party controllers only, and might be causing issues with fake PS4 controllers.

Reference https://github.com/libsdl-org/SDL/issues/7960
This commit is contained in:
Sam Lantinga 2023-07-10 09:15:02 -07:00
parent 5ce967a579
commit 092a4b780c
1 changed files with 69 additions and 66 deletions

View File

@ -307,6 +307,14 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
ctx->enhanced_mode = SDL_TRUE;
}
if (device->vendor_id == USB_VENDOR_SONY) {
ctx->official_controller = SDL_TRUE;
ctx->sensors_supported = SDL_TRUE;
ctx->lightbar_supported = SDL_TRUE;
ctx->vibration_supported = SDL_TRUE;
ctx->touchpad_supported = SDL_TRUE;
} else {
/* Third party controller capability request */
size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdCapabilities, data, sizeof(data));
/* Get the device capabilities */
if (size == 48 && data[2] == 0x27) {
@ -368,17 +376,12 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device)
ctx->accel_numerator = accel_numerator;
ctx->accel_denominator = accel_denominator;
}
} else if (device->vendor_id == USB_VENDOR_SONY) {
ctx->official_controller = SDL_TRUE;
ctx->sensors_supported = SDL_TRUE;
ctx->lightbar_supported = SDL_TRUE;
ctx->vibration_supported = SDL_TRUE;
ctx->touchpad_supported = SDL_TRUE;
} else if (device->vendor_id == USB_VENDOR_RAZER) {
/* The Razer Raiju doesn't respond to the detection protocol, but has a touchpad and vibration */
ctx->vibration_supported = SDL_TRUE;
ctx->touchpad_supported = SDL_TRUE;
}
}
ctx->effects_supported = (ctx->lightbar_supported || ctx->vibration_supported);
if (device->vendor_id == USB_VENDOR_PDP &&