From 169f77ed5e23503c1ceb0e9e786f1a4e6cd2e057 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Wed, 12 Jun 2024 23:36:16 -0700
Subject: [PATCH] Re-enable full controller reports for Joy-Con controllers
When they are in simple report mode, the thumbstick gets turned into a digital hat, so let's use them in full report mode.
(cherry picked from commit bf27269952742a9cc5db6e0a840fce51996b8675)
---
src/joystick/hidapi/SDL_hidapi_switch.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/joystick/hidapi/SDL_hidapi_switch.c b/src/joystick/hidapi/SDL_hidapi_switch.c
index c518fb7949d50..45a2260d1b035 100644
--- a/src/joystick/hidapi/SDL_hidapi_switch.c
+++ b/src/joystick/hidapi/SDL_hidapi_switch.c
@@ -762,6 +762,14 @@ static Uint8 GetDefaultInputMode(SDL_DriverSwitch_Context *ctx)
#if 0
input_mode = k_eSwitchInputReportIDs_FullControllerState;
#endif
+
+ /* However, Joy-Con controllers switch their thumbsticks into D-pad mode in simple mode,
+ * so let's enable full controller state for them.
+ */
+ if (ctx->device->product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT ||
+ ctx->device->product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT) {
+ input_mode = k_eSwitchInputReportIDs_FullControllerState;
+ }
}
return input_mode;
}