SDL: Implemented DEBUG_8BITDO_PROTOCOL

From 79a41ca7fc457e7ee0b7d21df79895de82d56767 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 1 Apr 2025 09:06:30 -0700
Subject: [PATCH] Implemented DEBUG_8BITDO_PROTOCOL

---
 src/joystick/hidapi/SDL_hidapi_8bitdo.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/joystick/hidapi/SDL_hidapi_8bitdo.c b/src/joystick/hidapi/SDL_hidapi_8bitdo.c
index 2711dd09d2341..0112698494db7 100644
--- a/src/joystick/hidapi/SDL_hidapi_8bitdo.c
+++ b/src/joystick/hidapi/SDL_hidapi_8bitdo.c
@@ -29,7 +29,10 @@
 #ifdef SDL_JOYSTICK_HIDAPI_8BITDO
 
 // Define this if you want to log all packets from the controller
-// #define DEBUG_8BITDO_PROTOCOL
+#if 0
+#define DEBUG_8BITDO_PROTOCOL
+#endif
+
 enum
 {
     SDL_GAMEPAD_BUTTON_8BITDO_L4 = 11,
@@ -383,6 +386,9 @@ static bool HIDAPI_Driver8BitDo_UpdateDevice(SDL_HIDAPI_Device *device)
     }
 
     while ((size = SDL_hid_read_timeout(device->dev, data, sizeof(data), 0)) > 0) {
+#ifdef DEBUG_8BITDO_PROTOCOL
+        HIDAPI_DumpPacket("8BitDo packet: size = %d", data, size);
+#endif
         if (!joystick) {
             continue;
         }