src/joystick


Log

Author Commit Date CI Message
Sam Lantinga 78422fa3 2020-11-13T13:17:07 Added more detail on the PS5 controller state packet and enable full reports over Bluetooth
Sam Lantinga 8cd4f364 2020-11-12T20:02:31 Mapped the touchpad click as SDL_CONTROLLER_BUTTON_MISC1 on the PS5 controller
Sam Lantinga 8e312a6a 2020-11-12T15:56:33 Fixed detecting Bluetooth XInput controllers on Windows
Sam Lantinga e0018d08 2020-11-12T14:23:56 Fixed Windows build
Sam Lantinga 5b0d4329 2020-11-12T07:53:03 Implemented trigger rumble in the HIDAPI Xbox One driver
Ozkan Sezer c122e9b9 2020-11-12T14:11:50 linux/SDL_sysjoystick.c (MaybeRemoveDevice): remove SDL_USE_LIBUDEV guards fixes bug #5349.
Sam Lantinga 83b653d5 2020-11-11T20:09:56 Fixed build warning
Sam Lantinga 76bd6cd2 2020-11-11T19:45:56 Fixed bug 5326 - Logitech Extreme 3D joystick is listed as gamepad in linux section of SDL_gamecontrollerdb.h Spooky For some reason the Logitech Extreme 3D joystick was added to SDL_gamecontrollerdb.h in the linux section only. This breaks the joystick in linux as it is not a gamepad. I am unable to correctly use or map the Logitech Exteme 3D joystick in games that use SDL2 in linux. Please remove Logitech Extreme 3D from SDL_gamecontrollerdb.h Linux section. It is a joystick not a gamepad.
Sam Lantinga 3160c7d6 2020-11-11T19:43:02 Fixed bug 5327 - When direct input fails to load, but a controlller is plugged in through another api, an access violation happens. Bart van der Werf When directinput fails to load, but a controlller is plugged in, an access violation happens. This is due to IEventHandler_CRawGameControllerVtbl_InvokeAdded calling SDL_DINPUT_JoystickPresent which does not check if dinput is assigned signalling initialization of directinput.
Sam Lantinga 502cfe31 2020-11-11T19:39:46 Fixed bug 5332 - WGI: Fix wrong level of indirection and implicit truncating cast. Joel Linn This fixes two types of MSVC compiler warnings. - One parameter in the function signatures of two WGI event handlers had one level of indirection too much (and did not match Windows SDK headers). The indirection was cast away so it still worked. - size_t was implicitly cast to UINT32 for a number of (constant) string lengths.
Sam Lantinga 320a7587 2020-11-11T19:26:59 Fixed compiler warnings
Simon McVittie b0eba1c5 2020-11-11T19:15:32 joystick: Use inotify to detect joystick unplug if not using udev This improves SDL's ability to detect joystick hotplug in a container environment. We cannot reliably receive events from udev in a container, because they are delivered as netlink events, which are authenticated by their uid being 0. However, in a user namespace created by an unprivileged user (for example bubblewrap, as used by Flatpak and Steam's pressure-vessel-wrap), the kernel does not allow us to map uid 0, and the netlink events appear to be from the kernel's overflowuid (typically 65534/nobody), meaning libudev cannot distinguish between genuine uevents from udevd and an attack by a malicious local user. Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie fdd945f2 2020-11-11T19:14:52 joystick: Use a better heuristic to guess what is a joystick Previously we only checked for at least one button or key and at least the X and Y absolute axes, but this has both false positives and false negatives. Graphics tablets, trackpads and touchscreens all have buttons and absolute X and Y axes, but we don't want to detect those as joysticks. On normal Linux systems ordinary users do not have access to these device nodes, but members of the 'input' group do. Conversely, some game controllers only have digital buttons and no analogue axes (the Nintendo Wiimote is an example), and some have axes and no buttons (steering wheels or flight simulator rudders might not have buttons). Use the more elaborate heuristic factored out from SDL's udev code path to handle these cases. In an ideal world we could use exactly the same heuristic as udev's input_id builtin, but that isn't under a suitable license for inclusion in SDL, so we have to use a parallel implementation of something vaguely similar. Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie 8db3171b 2020-11-11T19:14:34 udev: Factor out SDL_EVDEV_GuessDeviceClass This works on capability bitfields that can either come from udev or from ioctls, so it is equally applicable to both udev and non-udev input device detection. Signed-off-by: Simon McVittie <smcv@collabora.com>
Simon McVittie 13e7d1a9 2020-11-11T19:14:11 joystick: Allow libudev to be disabled at runtime Device enumeration via libudev can fail in a container for two reasons: * the netlink protocol between udevd and libudev is considered private, so there is no API guarantee that the version of libudev in a container will understand netlink messages from a dissimilar version of udevd on the host system; * the netlink protocol between udevd and libudev relies for security on being able to check the uid of each message, but in a container with a user namespace where host uid 0 is not mapped, the libudev client cannot distinguish between messages from host uid 0 and messages from a different, malicious user on the host To make this easier to experiment with, always compile the fallback code path even if libudev is disabled. libudev remains the default if enabled at compile time, but the fallback code path can be forced. Signed-off-by: Simon McVittie <smcv@collabora.com>
Sam Lantinga 1e2caac5 2020-11-11T18:57:37 Added SDL_JoystickRumbleTriggers() and SDL_GameControllerRumbleTriggers()
Sam Lantinga b6238c87 2020-11-11T14:48:23 Don't try to build the RAWINPUT driver if HIDAPI is disabled
Sam Lantinga d1e10c31 2020-11-11T14:38:14 Removed debug output
John "Nielk1" Klein 067630ae 2020-11-11T03:47:08 Fix hidapi for unhandled DS4 headset microphone data corrupting controller state
Sam Lantinga e12457d8 2020-11-10T12:26:30 Added support for the Xbox Series X controller to the HIDAPI driver
Sam Lantinga c3dea231 2020-11-09T22:39:33 Added support for reading the paddles on a Xbox Elite Series 2 controller in Bluetooth mode
Sam Lantinga fb4a406a 2020-11-09T18:45:22 Don't put 'm' in the GUID for Xbox and PS4 controllers on iOS
Sam Lantinga f8b8bd0b 2020-11-09T10:12:02 ControllerList: recategorize controller as swtich pro and not switch input-only controller
Sam Lantinga f76ca057 2020-11-09T10:11:59 ControllerList: add unknown xbox controller from minidumps
Sam Lantinga 1577366c 2020-11-08T23:49:03 Fixed duplicated switch statement processing Xbox controller dpad state
Sam Lantinga 4ea1a10b 2020-11-07T02:49:22 Added stub controller LED functions for WGI and RAWINPUT (thanks meyraud!)
Sam Lantinga 009b62f1 2020-11-07T02:22:15 Be explicit about mapping the new game controller paddle buttons
Sam Lantinga 749062e7 2020-11-06T16:53:13 Implemented SDL_GameControllerSetLED() for iOS/tvOS
Sam Lantinga faeac6e8 2020-11-06T16:42:46 Added additional game controller button support on iOS/tvOS
Sam Lantinga 3a3aaac2 2020-11-06T11:30:52 Added 4 auxiliary buttons to the game controller API Xbox Elite controllers use AUX1-AUX4 to represent the paddle buttons when using the HIDAPI driver PS4 and PS5 controllers use AUX1 to represent the touchpad button Nintendo Switch Pro controllers use AUX1 to represent the capture button
Sam Lantinga a22beef4 2020-11-05T17:03:28 Moved the PS5 controller driver to a separate file, as the advanced feature protocol is very different from that of the PS4
Sam Lantinga bd2dd3f6 2020-11-05T15:36:15 Added Android mapping for the Sony PS5 Controller
Sam Lantinga 4d79f966 2020-11-05T15:02:54 Added initial support for the Sony PS5 Controller
Sam Lantinga e555d453 2020-11-05T11:07:54 Added SDL_JoystickHasLED Currently, this is only supported by the PS4 HIDAPI driver.
Sam Lantinga ddc0727b 2020-10-27T09:00:42 Fixed implicit memcpy() when building for ARM64 on Windows (thanks Seigo!)
Bart van der Werf 3d92e8c7 2020-10-21T10:43:46 hidapi: Also parse data[12] with dpad values on the xb1s controller
Sam Lantinga 99ed0d7a 2020-10-16T12:40:12 Map the guide button by default on Android 11
Sam Lantinga 3755f692 2020-10-16T12:40:10 Added mapping for Xbox One S controller and PS4 controller on Android 11, including guide button
Sam Lantinga d9aea0c3 2020-10-15T10:13:42 Update the existing haptic player when we rumble on iOS
Sam Lantinga a558409b 2020-10-13T21:08:18 Only include CoreHaptics if we're building with rumble support
Sam Lantinga 75d5be97 2020-10-13T21:08:17 Fixed compiling with an older iOS SDK
Sam Lantinga 6b62494e 2020-10-13T21:08:15 Added support for controller battery status on iOS 14
Sam Lantinga 1b31e9f6 2020-10-13T21:08:13 Added support for game controller rumble on iOS 14
Sam Lantinga 2d7b33cb 2020-10-13T21:08:11 Added support for the controller home button on iOS 14
Sam Lantinga 45c644cc 2020-09-28T21:19:45 Added support for the MOGA XP5-X Plus
Kai Krakow c3ecf18c 2020-07-21T23:38:42 Linux: Add hint for disabling deadzones
Sam Lantinga cab1a715 2020-07-15T10:15:52 Fixed bug 5233 - PS3 Gamepad Motion Control not correctly ignored on Linux Igor Morgado PS3 Controller motion sensor string is being reported as `Gasia Co.,Ltd PS(R) Gamepad Motion Sensors` But `src/joystick/SDL_gamecontroller.c` line1690 only ignores if matches the string `Controller Motion Sensors`. ``` #if defined(__LINUX__) if (name && SDL_strstr(name, "Controller Motion Sensors")) { /* Don't treat the PS3 and PS4 motion controls as a separate game controller */ return SDL_TRUE; } #endif ``` Therefore, SDL is mapping 2 Game controllers instead one. Maybe reduce the substring to match `Motion Sensors` instead. A simple log from my application is shown below: INFO: Game controller device 0 - PS3 Controller:PS3 Controller found. INFO: Controller 0: Player 0: 054c:0268:8111 - PS3 Controller - PS3 Controller - Gasia Co.,Ltd PS(R) Gamepad INFO: Game controller device 1 - PS3 Controller:PS3 Controller found. INFO: Controller 1: Player 1: 054c:0268:8111 - PS3 Controller - PS3 Controller - Gasia Co.,Ltd PS(R) Gamepad Motion Sensors
stfx b1626295 2020-07-08T17:28:34 cmake: Fix building with -DSDL_HAPTIC=Off
Ryan C. Gordon 0e98040d 2020-06-28T16:23:05 joystick: Linux joysticks now recover better from dropped events. Fixes Bugzilla #4830.
stfx efe09359 2020-06-15T10:31:16 Fix compile without DIRECTX
Sam Lantinga aefe19ff 2020-06-09T11:31:39 Added support for the NACON Revolution Pro Controller 3 and the GameStop PS4 Fun Controller
Sam Lantinga 6f241bd5 2020-06-09T10:47:29 Fixed build
Sam Lantinga 086be21e 2020-06-09T10:47:27 ControllerList: add support for NACON asymetric controller and Revolution 3, Hori mini wireless ps4 controller, and 2 PDP switch controllers
Sam Lantinga 3b76109f 2020-06-09T10:47:25 ControllerList: remove giotek controller from list - vid/pid appears to be reused in bunch of devies including ones with different fw/protocol and treating as ps4 controller breaks them.
Sam Lantinga a9cfac38 2020-06-09T10:47:23 Controller: Deadzone improvements
Sam Lantinga 9fa8d6d0 2020-06-08T17:07:55 Define constants not available on older kernels
Sam Lantinga eea0b0e0 2020-06-02T17:08:31 Fixed bug 5168 - Memory leak in RAWINPUT_JoystickOpen meyraud705 Variable 'hwdata' is not freed in RAWINPUT_JoystickOpen if device->driver->OpenJoystick() fails.
Sam Lantinga ac1f174a 2020-06-02T17:02:37 Fixed bug 5167 - Memory leak in GuessXInputDevice meyraud705 Variable 'devices' is not freed if function GuessXInputDevice, in SDL_xinputjoystick.c, return early.
Sam Lantinga d000c1cd 2020-05-29T21:22:11 Fixed bug 5155 - HIDAPI_JoystickDisconnected incorrect array shift Anthony Pesch I was looking into my own input bug and noticed an issue in the HIDAPI code while looking over it. I don't have a controller that goes down this path to test and try to provoke the issue, but it looks pretty straight forward. The memmove to shift the joystick id array on disconnect isn't scaling the size by sizeof(SDL_JoystickID), likely corrupting the ids on disconnect.
Sam Lantinga ae9ff11b 2020-05-29T14:54:07 The zero happens at a higher level now
Sam Lantinga 39c958bb 2020-05-29T14:48:39 Initialize the raw_map before getting controller mappings from the driver
Sam Lantinga 2db04947 2020-05-29T14:48:05 Fixed variable names to be consistent across functions
Sam Lantinga 345b4d7e 2020-05-29T13:37:21 Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification Jan Bujak I wrote a new driver for my gamepad on Linux. I'd like SDL to support it out-of-box, as currently it just treats it as a generic joystick instead of a gamepad. From what I can see the only way to do that is to either 1) pick one of the already supported controllers' PID, VID and button layouts and have my driver send that (effectively lying that it's something else), or 2) submit a preconfigured, hardcoded mapping to SDL. Both of those, in my opinion, are silly when we already have the Linux Gamepad Specification which standarizes this: https://www.kernel.org/doc/html/v4.15/input/gamepad.html Unfortunately SDL doesn't make use of it currently. So I've took it upon myself to add it; patch is in the attachments. Basically what the patch does is that if SDL finds no built-it controller mappings for a given joystick it then asks the joystick backend to autodetect it, and that uses the relevant evdev bits to figure out which button/axis is which. (See the specs for more details.) With this patch applied my own driver for my controller works out-of-box with SDL with no extra configuration and is correctly recognized as a gamepad; this is also going to be the case for any other driver which follows the Linux Gamepad Specification.
Sam Lantinga 1a1f1704 2020-05-27T10:35:43 Don't include the iOS joystick driver if joysticks are disabled
Sam Lantinga e9f567c7 2020-05-27T10:14:08 Fixed building on iOS with MFI controllers disabled
Ryan C. Gordon 5fe34a40 2020-05-20T17:01:25 hidapi: Fix compiler warning.
Ryan C. Gordon 68777406 2020-05-20T16:58:33 windows: Fix calls to CoCreateInstance() so last parameter is a LPVOID *.
Sam Lantinga 1e5dd06f 2020-05-06T12:19:58 Added support for the HORI Real Arcade Pro on Mac OSX and Linux
Sam Lantinga cd2bdaef 2020-05-06T11:19:52 ControllerList: add PDP Faceoff Deluxe Audio Switch Controller and HORI Real Arcade Pro V Switch Edition
Sam Lantinga 0e5b48d2 2020-05-06T11:19:47 ControllerList: add NACON Revolution Unlimited (and it's dongle) and NACON Daija fight stick.
Sam Lantinga 11723411 2020-05-04T10:16:10 Added support for the Razer Kishi
Ethan Lee 83cddd2e 2020-04-30T11:57:29 Add SDL_JoystickSetLED. Currently, this is only supported by the PS4 HIDAPI driver.
Sam Lantinga b0b12e46 2020-04-27T13:31:10 Fixed running on older versions of iOS
Cameron Gutman 134362e7 2020-04-25T19:15:51 Enable Xbox One HIDAPI driver on macOS The Xbox One HIDAPI driver is required on macOS for Xbox One S Bluetooth support since https://hg.libsdl.org/SDL/rev/10c3a10908e9
Brendan Shanks 032fa681 2020-04-24T14:03:30 Add Logitech G29 to steering wheel list
Sam Lantinga 01fd8130 2020-04-23T11:13:02 Fixed compiler warning
Sam Lantinga c6b24b4b 2020-04-23T11:07:07 Added support for the following controllers: * 8BitDo N30 Pro 2 * 8BitDo SN30 Gamepad * 8BitDo SN30 Pro+ * 8BitDo Zero 2 * SZMY-POWER PC Gamepad * ThrustMaster eSwap PRO Controller * ZEROPLUS P4 Wired Gamepad In additional, all 8BitDo controllers use SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS to have the correct mapping based on user preferences.
Sam Lantinga 4727f794 2020-04-23T10:13:17 Don't use the WGI driver if another driver is already handling the joystick
Sam Lantinga 6ca7f510 2020-04-23T09:35:32 Fixed crash trying to get battery status on some devices
Sam Lantinga d12ea89c 2020-04-22T10:50:50 Added support for the following controllers: * PDP Afterglow Switch Controller * Thrustmaster ESwap Pro PS4 controller * Giotek VX4 * Generic PS4 controller vid/pid that several knock offs use
Ryan C. Gordon 67760f0e 2020-04-20T18:58:18 joystick: Don't report duplicate recentering events for game controllers.
Ryan C. Gordon c5f2a1ce 2020-04-20T16:01:36 joystick: On disconnect, recenter all game controller inputs. The joystick layer can't necessarily give us perfect centering, but we know that the game controller level has logical absolute idle positions that have nothing to do with the physical device. So send game controller events to make it look like the device is completely untouched before sending the final removal event.
Sam Lantinga aba27928 2020-04-18T21:41:37 Added a Windows Gaming Input joystick driver This driver supports the Razer Atrox Arcade Stick Some of the quirks of this driver, inherent in Windows Gaming Input: * There will never appear to be controllers connected at startup. You must support hot-plugging in order to see these controllers. * You can't read the state of the guide button * You can't get controller events in the background
Sam Lantinga b90b5927 2020-04-17T21:30:58 Added support for the Razer Atrox Arcade Stick
Sam Lantinga dbcda0b2 2020-04-17T21:30:56 Added support for the Razer Wolverine Ultimate
Sam Lantinga 2b323855 2020-04-17T15:08:48 Don't send rumble packets too quickly to Nintendo Switch Pro controllers over Bluetooth
Sam Lantinga c02f54a0 2020-04-17T15:08:46 Fixed the default face button mapping for Nintendo Switch Pro controllers
Ryan C. Gordon a7a4e16b 2020-04-15T13:31:54 haiku: Patched to compile.
Sam Lantinga 50b1c195 2020-04-14T09:55:33 Fixed bug 5091 - Suspicious condition in HIDAPI_DriverXbox360_UpdateXInput meyraud705 On line 220 of SDL_hidapi_xbox360.c https://hg.libsdl.org/SDL/file/4608f0e6e8e3/src/joystick/hidapi/SDL_hidapi_xbox360.c#l220 if (!XINPUTGETSTATE(user_index, &xinput_state[user_index].state) == ERROR_SUCCESS) { logical not is only applied to the left hand side of this comparison. I think you mean: if (XINPUTGETSTATE(user_index, &xinput_state[user_index].state) != ERROR_SUCCESS) {
Sam Lantinga f34d2c60 2020-04-14T07:35:35 Added zlib license for Steam Controller headers
Sam Lantinga c302c1ab 2020-04-13T13:24:19 Fixed build
Sam Lantinga bf87604e 2020-04-13T12:33:29 Fixed rare crash when unplugging Xbox controller on Windows
Sam Lantinga 55515a8c 2020-04-08T08:42:15 SDL: ps4 controller trigger bits on other controllers just mean that there's some activity, not saturation - only force it on if the analog value is 0.
Ryan C. Gordon 8c165add 2020-04-07T23:17:27 joystick: Remove force_centering flag; we handle this on disconnect now.
Sam Lantinga 3cb62d52 2020-04-07T11:17:52 Fixed setting the controller name for the RAWINPUT driver
Sam Lantinga e62c25b6 2020-04-07T11:17:22 The 0x02ff product ID shows up for new firmware Xbox One controllers using the RAWINPUT driver
Sam Lantinga 88cecee4 2020-04-07T10:14:12 Fixed build warning
Sam Lantinga 50cb8e0f 2020-04-07T10:13:08 Fixed deadlock in new raw input joystick code The appropriate locking is done elsewhere, this prevents inverted lock acquisition
Sam Lantinga b6afbe63 2020-04-07T09:38:57 Added SDL_log.h to SDL_internal.h so logging is available everywhere
Sam Lantinga 3154d924 2020-03-30T14:26:21 SDL: plumb previously unused digital trigger bits for PS4 controllers. Victrix fight stick only sets these bits and doesn't send the analog values CR: SamL