From 6675ea91471e662056dba3b57c33c5ad383ca291 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 28 May 2026 19:51:34 -0700
Subject: [PATCH] Added DEBUG_STEAM_PROTOCOL for the new Steam Controller
(cherry picked from commit 634dff3725b8419902b832d1c84363da211a3596)
---
src/joystick/hidapi/SDL_hidapi_steam.c | 4 +++-
src/joystick/hidapi/SDL_hidapi_steam_triton.c | 9 +++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/joystick/hidapi/SDL_hidapi_steam.c b/src/joystick/hidapi/SDL_hidapi_steam.c
index 0ebb723af3755..cb6add70d20d6 100644
--- a/src/joystick/hidapi/SDL_hidapi_steam.c
+++ b/src/joystick/hidapi/SDL_hidapi_steam.c
@@ -29,7 +29,9 @@
#ifdef SDL_JOYSTICK_HIDAPI_STEAM
// Define this if you want to log all packets from the controller
-// #define DEBUG_STEAM_PROTOCOL
+#if 0
+#define DEBUG_STEAM_PROTOCOL
+#endif
#define SDL_HINT_JOYSTICK_HIDAPI_STEAM_PAIRING_ENABLED "SDL_JOYSTICK_HIDAPI_STEAM_PAIRING_ENABLED"
diff --git a/src/joystick/hidapi/SDL_hidapi_steam_triton.c b/src/joystick/hidapi/SDL_hidapi_steam_triton.c
index 4d8d8238b7fed..01e4efff96eb1 100644
--- a/src/joystick/hidapi/SDL_hidapi_steam_triton.c
+++ b/src/joystick/hidapi/SDL_hidapi_steam_triton.c
@@ -27,6 +27,11 @@
#ifdef SDL_JOYSTICK_HIDAPI_STEAM_TRITON
+// Define this if you want to log all packets from the controller
+#if 0
+#define DEBUG_STEAM_PROTOCOL
+#endif
+
/*****************************************************************************************************/
#include "steam/controller_constants.h"
@@ -517,6 +522,10 @@ static bool HIDAPI_DriverSteamTriton_UpdateDevice(SDL_HIDAPI_Device *device)
return false;
}
+#ifdef DEBUG_STEAM_PROTOCOL
+ HIDAPI_DumpPacket("Steam Controller packet: size = %d", data, r);
+#endif
+
switch (data[0]) {
case ID_TRITON_CONTROLLER_STATE:
case ID_TRITON_CONTROLLER_STATE_BLE: