From f4d1f5ed54aecbbccf20e4967b14f965196b7694 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sun, 23 Oct 2022 16:35:36 -0700 Subject: [PATCH] SDL-HIDPS4: fix PS4 Slim controller over BT - it sends the same input report as the it does over USB, but with a larger packet size CR: saml --- src/joystick/hidapi/SDL_hidapi_ps4.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c index 64c3054fc..b2df90e46 100644 --- a/src/joystick/hidapi/SDL_hidapi_ps4.c +++ b/src/joystick/hidapi/SDL_hidapi_ps4.c @@ -1010,8 +1010,10 @@ HIDAPI_DriverPS4_IsPacketValid(SDL_DriverPS4_Context *ctx, Uint8 *data, int size case k_EPS4ReportIdUsbState: /* In the case of a DS4 USB dongle, bit[2] of byte 31 indicates if a DS4 is actually connected (indicated by '0'). * For non-dongle, this bit is always 0 (connected). + * This is usually the ID over USB, but the DS4v2 that started shipping with the PS4 Slim will also send this + * packet over BT with a size of 128 */ - if (size == 64 && (data[31] & 0x04) == 0) { + if (size >= 64 && (data[31] & 0x04) == 0) { return SDL_TRUE; } break;