Commit Graph

2567 Commits

Author SHA1 Message Date
Sam Lantinga
ef3196bedd Fixed a crash if we get a HID device with no path
This can happen on Linux if udev_device_get_devnode() fails.

(cherry picked from commit bb4eedd67d)
2026-05-11 16:48:43 -07:00
Rachel Blackman
7e101bdce9 Ensure Android gamepad mappings don't lose the first button.
(cherry picked from commit fd3cfb97c1)
2026-05-11 12:59:59 -07:00
Nintorch
b52e6d10ce Ignore Keychron K10 Pro and Huion Tablet_GS1331
(cherry picked from commit 287e2573cd)
2026-05-11 11:11:24 -07:00
Sam Lantinga
a730905a2b Fixed build
(cherry picked from commit ab19d09939)
2026-05-06 19:42:51 -07:00
Sam Lantinga
ef9963df0d Don't report 10% battery for Xbox controllers using XInput
(cherry picked from commit 386f198622)
2026-05-06 18:12:29 -07:00
Nintorch
3013f975ac Fix JoyCon mappings on Android
(cherry picked from commit 3c1636a958)
2026-05-04 11:49:45 -07:00
Nintorch
52b6bceedf Add support for joystick motion sensors on Android
(cherry picked from commit c699512adc)
2026-05-03 15:11:59 -07:00
Nintorch
c239edd6e0 Fix Xbox controller names in MFI joystick backend (#15499)
controller.vendorName returns a generic name for Xbox controllers ("Controller"), so we have to give them proper names.

(cherry picked from commit c805a4d632)
2026-05-03 09:26:38 -07:00
Sam Lantinga
1d75b6bc59 Fixed crash on Windows when a controller is connected
(cherry picked from commit 4a52a5ee04)
2026-05-01 16:57:47 -07:00
Sam Lantinga
65eda5fbd4 Fixed copyright on SDL_hidapi_steam_triton.c
Fixes https://github.com/libsdl-org/SDL/issues/15486
Closes https://github.com/libsdl-org/SDL/pull/15487

(cherry picked from commit e9a6d7eda0)
2026-04-30 19:56:07 -07:00
Sam Lantinga
d7af22f927 Disable accidentally enabled debug logging
(cherry picked from commit e1e6cbe6ec)
2026-04-28 17:26:48 -07:00
Sam Lantinga
3164b74256 Don't use the fake HID endpoint for Xbox controllers on Windows
(cherry picked from commit d5fca9628a)
2026-04-28 14:10:29 -07:00
ShulkerSakura
1d228f8a7d Add keychron Q3 blacklist (#15462)
(cherry picked from commit 543a05bf08)
2026-04-26 07:45:43 -07:00
Sam Lantinga
eebe7558d5 Fixed the menu controller button state on recent Apple platforms
The OS reports the button state as of macOS 11.0, iOS 14.0, and tvOS 14.0, so use that instead of the deprecated pause handler.

(cherry picked from commit 1146ea484a)
2026-04-24 11:38:13 -07:00
Sam Lantinga
b00d32c10a Don't do name blacklisting if there's no name
(cherry picked from commit c124da4367)
2026-04-24 07:34:54 -07:00
Nintorch
563b8cb51c Include OS detection in Emscripten joystick GUID
This PR modifies the Emscripten joystick backend to detect the user's OS and store its ID in the GUID, because different OSes might need different mappings for the same controllers.
I'm not sure if different browsers on the same OS can also have different mappings, but if they can, browser detection can be added to the GUID too if needed.

This PR also makes the GUID use `SDL_HARDWARE_BUS_USB` instead of `SDL_HARDWARE_BUS_UNKNOWN`, similarly to how Android and MFI backends always use `SDL_HARDWARE_BUS_BLUETOOTH` and GameInput, XInput, and RawInput backends always use `SDL_HARDWARE_BUS_USB`.

(cherry picked from commit 60a59fa557)
2026-04-21 10:35:52 -07:00
Nintorch
9cdad39b52 Add trigger rumble support to Emscripten joysticks
This PR adds trigger rumble support to the Emscripten joystick backend.

(cherry picked from commit 651136ac7a)
2026-04-21 07:46:16 -07:00
atiradonet
7ca97d0791 joystick: Add VIRPIL Controls flight stick and throttle device IDs. (#15418)
VIRPIL Controls (VID 0x3344) flight sticks are misclassified as
gamepads by SDL's axis-count heuristic because they report exactly
6 axes, matching SDL_GAMEPAD_AXIS_COUNT. Adding them to the
appropriate device lists ensures correct classification.

Tested on Linux (Fedora 43, kernel 6.19) with:
- R-VPC Stick MT-50CM3 (PID 0x4391) -> SDL_JOYSTICK_TYPE_FLIGHT_STICK
- L-VPC Stick MT-50CM3 (PID 0x8390) -> SDL_JOYSTICK_TYPE_FLIGHT_STICK
- VPC VMAX Prime Throttle (PID 0x0196) -> SDL_JOYSTICK_TYPE_THROTTLE

(cherry picked from commit 3b89c7b537)
2026-04-20 09:04:42 -07:00
Ozkan Sezer
7f3071a207 SDL_hidapi_zuiki.c: silence bogus -Warray-bounds warnings from gcc-4.9
(cherry picked from commit f61a22e10f)
2026-04-07 06:47:02 +03:00
Sam Lantinga
a883e69d7b Use the correct index for PS2 controllers
Closes https://github.com/libsdl-org/SDL/pull/15294

(cherry picked from commit 41c3a91079)
2026-04-03 16:08:55 -07:00
Sanjay Govind
8d7f469fb5 Add support for GIP guitars via gameinput (#15301)
(cherry picked from commit 7f86f9107d)
2026-04-03 16:03:17 -07:00
foxtacles
18463ccb8f (emscripten) Add null checks for gamepad in vendor/product/xinput helpers (#15313)
navigator.getGamepads() can return null for a slot if the gamepad
disconnects between the gamepadconnected event and the proxied
MAIN_THREAD_EM_ASM_INT call. This causes a TypeError when accessing
gamepad.id. Add null guards matching the pattern already used in
EMSCRIPTEN_JoystickOpen and EMSCRIPTEN_JoystickRumble.

(cherry picked from commit 59602fb473)
2026-04-03 15:08:37 -07:00
Christian Semmler
5be888591c emscripten: Fix navigator.getGamepads crash in worker threads
The three EM_JS functions (SDL_GetEmscriptenJoystickVendor,
SDL_GetEmscriptenJoystickProduct, SDL_IsEmscriptenJoystickXInput)
call navigator.getGamepads() which is only available on the main
browser thread. With PROXY_TO_PTHREAD, the joystick callbacks are
dispatched to a worker where the Gamepad API is not available,
causing a TypeError.

Convert these from EM_JS to static functions using
MAIN_THREAD_EM_ASM_INT, which proxies the JavaScript execution to
the main browser thread. This matches the pattern already used by
other navigator.getGamepads() calls in the same file.

(cherry picked from commit be8643f739)
2026-04-02 19:37:33 -07:00
Sanjay Govind
b264c19c83 Update to GameInput V3 (#15302)
(cherry picked from commit c58a61fdd4)
2026-04-02 17:10:59 -07:00
Janne Virtala
212f7539cb SDL_PrivateJoystickForceRecentering(): fix infinite loop
(cherry picked from commit b5ef75249f)
2026-04-02 09:28:15 -07:00
Steel
0bf2065922 Add support for PXN VD6 Wheelbase
(cherry picked from commit 32cf5fe93d)
2026-03-16 10:51:30 -07:00
Rachel Blackman
8ba903c859 Add second-gen Backbone One to recognized controllers.
(cherry picked from commit ba00e772a7)
2026-03-13 15:40:29 -07:00
Sam Lantinga
6248eeec09 Disable system gesture state for all GCControllers
Technically we only want to do this for controllers that are opened, but we don't have a way to match up controllers using other APIs with individual GCControllers.

(cherry picked from commit 11adfd2008)
2026-03-12 08:43:19 -07:00
Nintorch
ffd2696516 Fallback for non-gamepad controllers in GameInput
This PR makes the GameInput joystick backend ignore non-gamepad controllers if DirectInput or XInput backends are enabled. This is done to prevent possible bugs and/or regressions.

(cherry picked from commit 419dcfe747)
2026-03-10 11:06:37 -07:00
Nintorch
66020c2ed7 Small GameInput joystick backend improvements
This PR includes small improvements to the GameInput joystick backend:
- Device subtypes
- Compatibility with DirectInput joystick mappings (if the controller is not a gamepad, i.e. `GAMEINPUT_InternalIsGamepad()` returns `false`)
- Fallback to DirectInput/XInput for currently unsupported devices (force feedback ones and the ones that are neither gamepads nor controllers, I'm not sure if that's possible, but maybe racing wheels and other device subtypes would count?)

(cherry picked from commit 0138843eb7)
2026-03-09 11:12:30 -07:00
Sanjay Govind
36ed4b75d1 support batteries on 3rd party controllers
(cherry picked from commit e610b85d1c)
2026-03-08 11:40:56 -07:00
Sanjay Govind
b08f7924a4 Add support for whammy and tilt on PS4/5 guitars
PS4/5 controllers put device specific data into a specific region in the report, so we have to extract it separately.

No known guitars use the right stick on the guitar, so to keep things working similarly to PS3, i have opted to map whammy and tilt the same way as the PS3 rb guitars.

(cherry picked from commit 94f17d6c61)
2026-03-08 11:36:17 -07:00
Sanjay Govind
1ee158cd31 fix off by one with tilt on ps3 guitars (#15144)
(cherry picked from commit 34378609bb)
2026-03-02 09:45:54 -08:00
zuiki_inn
6d93ffe923 Add ZUIKI EVOTOP controller support with gyroscope and accelerometer sensor capabilities. (#15034)
(cherry picked from commit 29ca920fdf)
2026-02-25 20:24:50 -08:00
Sam Lantinga
aa9de89232 Added battery status for newer FlyDigi controllers
(cherry picked from commit 49a8b4229b)
2026-02-24 20:50:11 -08:00
Sanjay Govind
645b8e7f6d Support accelerometers on 3rd party ps3 controllers (#15109)
(cherry picked from commit 0c859452ef)
2026-02-24 19:00:11 -08:00
Sanjay Govind
17532fd62e Set joystick_type for known ps3/wii instruments (#15111)
(cherry picked from commit a7ccd48957)
2026-02-24 17:30:07 -08:00
Sanjay Govind
2214522b69 deal with controllers that don't have report ids
(cherry picked from commit 1419bcb6cb)
2026-02-24 15:19:49 -08:00
Sanjay Govind
b3adee0720 Fix up controller types for various playstation and wii instruments (#15104)
(cherry picked from commit 0e4008441f)
2026-02-24 13:36:08 -08:00
Sam Lantinga
00c85a0b9e Added support for the Flydigi Vader 5 Pro in Xbox 360 mode
(cherry picked from commit 2385dc6297)
2026-02-24 10:20:29 -08:00
Vicki Pfau
399b2b18ce Support SL/SR on Switch 2 controllers, but only in mini-controller mode
It doesn't really make sense to support these in combined mode since they're usually occluded.

(cherry picked from commit 8a1684fbbc)
2026-02-24 06:53:41 -08:00
Ryan C. Gordon
7cc9955ae1 emscripten: Move some EM_ASM blocks to MAIN_THREAD_EM_ASM.
These blocks reference the `navigator` global, which is not available in
background threads.

(cherry picked from commit c728e2f044)
2026-02-20 10:28:12 -05:00
Sam Lantinga
3b4cf41c92 Fixed HIDAPI PS5 Bluetooth report format
(cherry picked from commit 129627068f)
2026-02-17 08:57:28 -08:00
Sam Lantinga
9f0ebbef46 Steam Controller report 0x45 is used for BLE mode
(cherry picked from commit 0b1c592fda)
2026-02-12 15:46:19 -08:00
Sam Lantinga
6707df6d88 Updated Steam Controller packet handling
(cherry picked from commit 84c21cf970)
2026-02-12 14:34:52 -08:00
Sam Lantinga
b467276f4a Fixed initializing the PowerA Fusion Pro 4 on Steam Link hardware
(cherry picked from commit 2b484a1ccb)
2026-02-11 16:54:42 -08:00
Sam Lantinga
17eb20505c Fix the 8BitDo Ultimate 2D Wireless Controller showing up multiple times
This controller has 3 interfaces, one for the Xbox gamepad protocol, and two HID interfaces. We should only handle the Xbox interface in the Xbox driver.

(cherry picked from commit 9f8c70713a)
2026-02-09 13:29:47 -08:00
Vicki Pfau
2b72332b81 Fix Switch and Switch 2 player LED patterns
The patterns we were using don't match the official patterns, which fill up as
many lights as players instead of just using the nth player LED. Above 4,
there are some special patterns, as documented on Nintendo's Singaporean site:
https://www.nintendo.com/sg/support/qa/detail/33822

(cherry picked from commit 017d950b6b)
2026-02-07 07:37:51 -08:00
Vicki Pfau
45086459d2 Add and use libusb_set_auto_detach_kernel_driver for the Switch 2 driver
(cherry picked from commit e1b8ad0380)
2026-02-05 14:59:10 -08:00
Sam Lantinga
38b9c9117d Fixed warning: no previous prototype for function 'SDL_PrivateIsGamepadPlatformMatch'
(cherry picked from commit cd14bf3d00)
2026-02-04 14:41:27 -08:00