From 28849fd78925bae55e2b40fe11c7bf689bd7542b Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sat, 1 Nov 2025 13:15:30 -0700
Subject: [PATCH] Manually enable acquiring the Apex 5 controller if necessary
The FlyDigi Space Station app isn't available on non-Windows platforms, so we need to manually enable acquiring the controller on those platforms.
---
src/joystick/hidapi/SDL_hidapi_flydigi.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/joystick/hidapi/SDL_hidapi_flydigi.c b/src/joystick/hidapi/SDL_hidapi_flydigi.c
index 9ea1a887ccd8b..a36b022834fc8 100644
--- a/src/joystick/hidapi/SDL_hidapi_flydigi.c
+++ b/src/joystick/hidapi/SDL_hidapi_flydigi.c
@@ -268,8 +268,22 @@ static bool HIDAPI_DriverFlydigi_InitControllerV2(SDL_HIDAPI_Device *device)
return SDL_SetError("Couldn't get controller status");
}
if (data[10] != 1) {
+#ifdef SDL_PLATFORM_WINDOWS
// Click "Allow third-party apps to take over mappings" in the FlyDigi Space Station app
return SDL_SetError("Controller acquiring is disabled");
+#else
+ // The FlyDigi Space Station app isn't available, we need to enable this ourselves
+ Uint8 enable_acquire[32] = {
+ FLYDIGI_V2_CMD_REPORT_ID,
+ FLYDIGI_V2_MAGIC1,
+ FLYDIGI_V2_MAGIC2,
+ FLYDIGI_V2_SET_STATUS_COMMAND,
+ 0x07, 0xff, 0xff, 0xff, 0xff, 0x01, 0x15
+ };
+ if (SDL_hid_write(device->dev, enable_acquire, sizeof(enable_acquire)) < 0) {
+ return SDL_SetError("Couldn't set controller status");
+ }
+#endif // SDL_PLATFORM_WINDOWS
}
return true;
}