浏览代码

Turn HIDAPI joystick support off by default on mobile platforms

On Android, HIDAPI prompts for permissions and acquires exclusive access to the device, and on Apple mobile platforms it doesn't do anything except for handling Bluetooth Steam Controllers.

Fixes https://github.com/libsdl-org/SDL/issues/9241
Sam Lantinga 1 年之前
父节点
当前提交
e3cf2e4794
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      src/joystick/hidapi/SDL_hidapijoystick_c.h

+ 8 - 0
src/joystick/hidapi/SDL_hidapijoystick_c.h

@@ -48,7 +48,15 @@
 #define SDL_JOYSTICK_CAP_TRIGGER_RUMBLE 0x00000020
 #define SDL_JOYSTICK_CAP_TRIGGER_RUMBLE 0x00000020
 
 
 /* Whether HIDAPI is enabled by default */
 /* Whether HIDAPI is enabled by default */
+#if defined(SDL_PLATFORM_ANDROID) || \
+    defined(SDL_PLATFORM_IOS) || \
+    defined(SDL_PLATFORM_TVOS) || \
+    defined(SDL_PLATFORM_VISIONOS)
+/* On Android, HIDAPI prompts for permissions and acquires exclusive access to the device, and on Apple mobile platforms it doesn't do anything except for handling Bluetooth Steam Controllers, so we'll leave it off by default. */
+#define SDL_HIDAPI_DEFAULT SDL_FALSE
+#else
 #define SDL_HIDAPI_DEFAULT SDL_TRUE
 #define SDL_HIDAPI_DEFAULT SDL_TRUE
+#endif
 
 
 /* The maximum size of a USB packet for HID devices */
 /* The maximum size of a USB packet for HID devices */
 #define USB_PACKET_LENGTH 64
 #define USB_PACKET_LENGTH 64