Return true from IsSupportedDevice if it's a device that we _might_ support This forces an update of the device list so we have the correct state when we check to see whether a device is being handled by HIDAPI
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c
index 216a37f..205e70f 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps4.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps4.c
@@ -185,11 +185,19 @@ HIDAPI_DriverPS4_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name,
return SDL_TRUE;
}
- if (device && SONY_THIRDPARTY_VENDOR(device->vendor_id) &&
- (size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdCapabilities, data, sizeof(data))) == 48 &&
- data[2] == 0x27) {
- /* Supported third party controller */
- return SDL_TRUE;
+ if (SONY_THIRDPARTY_VENDOR(vendor_id)) {
+ if (device) {
+ if ((size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdCapabilities, data, sizeof(data))) == 48 &&
+ data[2] == 0x27) {
+ /* Supported third party controller */
+ return SDL_TRUE;
+ } else {
+ return SDL_FALSE;
+ }
+ } else {
+ /* Might be supported by this driver, enumerate and find out */
+ return SDL_TRUE;
+ }
}
return SDL_FALSE;
diff --git a/src/joystick/hidapi/SDL_hidapi_ps5.c b/src/joystick/hidapi/SDL_hidapi_ps5.c
index 187bfb2..1508d4e 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps5.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps5.c
@@ -267,13 +267,20 @@ HIDAPI_DriverPS5_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name,
return SDL_TRUE;
}
- if (device && SONY_THIRDPARTY_VENDOR(device->vendor_id) &&
- (size = ReadFeatureReport(device->dev, k_EPS5FeatureReportIdCapabilities, data, sizeof(data))) == 48 &&
- data[2] == 0x28) {
- /* Supported third party controller */
- return SDL_TRUE;
+ if (SONY_THIRDPARTY_VENDOR(vendor_id)) {
+ if (device) {
+ if ((size = ReadFeatureReport(device->dev, k_EPS5FeatureReportIdCapabilities, data, sizeof(data))) == 48 &&
+ data[2] == 0x28) {
+ /* Supported third party controller */
+ return SDL_TRUE;
+ } else {
+ return SDL_FALSE;
+ }
+ } else {
+ /* Might be supported by this driver, enumerate and find out */
+ return SDL_TRUE;
+ }
}
-
return SDL_FALSE;
}