Browse Source

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
Sam Lantinga 2 years ago
parent
commit
f4d1f5ed54
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/joystick/hidapi/SDL_hidapi_ps4.c

+ 3 - 1
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;