src/joystick


Log

Author Commit Date CI Message
Sam Lantinga 1c865c46 2020-11-27T18:57:36 Load the raw input device list at init time so it's available when DirectInput is doing device detection
Sam Lantinga a0c5bfa3 2020-11-27T13:08:40 Moved raw input event processing from the main thread to the joystick thread This allows fast joystick event delivery regardless of what the main thread is doing.
Sam Lantinga 4fbefbe2 2020-11-27T11:33:53 Sort the raw input axes by usage, so X comes before Y, etc.
Sam Lantinga 4ddac485 2020-11-27T11:33:51 Backed out minor optimization that prevented correlation_id from being set
Sam Lantinga 8973a258 2020-11-27T10:44:56 Enable dispatching of WM_INPUT_DEVICE_CHANGE events directly, in case the application hasn't created a window with the normal message loop
Sam Lantinga e8adc648 2020-11-27T10:44:55 Enable dispatching of WM_INPUT events directly, in case the application hasn't created a window with the normal message loop
Sam Lantinga 0252235e 2020-11-27T10:44:53 Recheck devices if another API queries raw input for a new device
Sam Lantinga a7dede7e 2020-11-27T10:44:51 Re-enable axis correlation for raw input controllers, for twin stick shooters that don't need face buttons
Sam Lantinga ce77966d 2020-11-27T10:44:49 Fixed RAWINPUT_IsDevicePresent() not returning TRUE for Xbox One controllers
Sam Lantinga 8a449de2 2020-11-27T10:44:47 Fixed Xbox 360 wireless controller being picked up by WGI when it's being managed by RAWINPUT
Sam Lantinga 37c9e4af 2020-11-27T06:03:15 Fixed processing WM_INPUT_DEVICE_CHANGE at startup
Sam Lantinga 248fc75b 2020-11-27T05:53:56 Correlate just based on buttons, joystick axes are not as precise and could potentially cause incorrect uncorrelation. It's okay if the triggers aren't precise until someone presses a button on their controller.
Sam Lantinga e7e615de 2020-11-27T05:53:54 Removed extraneous windows message pumping Most of the raw input events are dispatched in the main windows message loop. We only dispatch device change messages separately when we need them to be completely up to date.
Sam Lantinga 2931eccd 2020-11-27T05:53:52 Fixed detecting Bluetooth raw input devices, which have device names longer than 128 characters
Sam Lantinga 849ce803 2020-11-27T05:53:50 Renamed SDL_JOYSTICK_RAWINPUT_GAMING_INPUT to SDL_JOYSTICK_RAWINPUT_WGI
Sam Lantinga 219a28dd 2020-11-27T03:45:05 Fixed D-pad uncorrelating raw input controllers (thanks Jimbly!)
Ozkan Sezer 3fbff2a4 2020-11-26T10:47:33 SDL_rawinputjoystick.c: fix ambiguous 'else' warning src/joystick/windows/SDL_rawinputjoystick.c: In function 'RAWINPUT_HandleStatePacket': src/joystick/windows/SDL_rawinputjoystick.c:1343:9: warning: suggest explicit braces to avoid ambiguous 'else'
Sam Lantinga 845b9033 2020-11-25T16:46:42 Implemented trigger rumble for raw input controllers
Sam Lantinga 517be808 2020-11-25T16:05:19 Implemented battery status for Bluetooth Xbox One controllers Also switched the rumble loop count to 0xEB (one hour) to match Windows driver
Sam Lantinga 6a7f29cd 2020-11-25T11:31:17 Fixed compiling on tvOS
Sam Lantinga 9ec2cf56 2020-11-25T10:31:59 Fixed building with Windows.Gaming.Input enabled
Sam Lantinga 3c07dd12 2020-11-25T10:28:48 Strip an extra '.' off of the HORI manufacturer name
Sam Lantinga 159d1b3d 2020-11-25T01:35:45 Don't set the serial number after the controller is opened We'll use the USB value instead so it's available as soon as it's opened.
Sam Lantinga 7d92b14f 2020-11-25T01:18:18 Simplified Xbox One controller initialization state, and don't query for the serial number.
Sam Lantinga 9fc4a4c9 2020-11-24T22:25:26 Revamped Xbox One HIDAPI init sequence Added support for querying the controller serial number on newer firmware
Sam Lantinga e4b7d9a2 2020-11-24T07:56:59 Removed usage of TARGET_OS_OSX for building with older SDKs
Sam Lantinga a5cde4cb 2020-11-24T07:29:55 Fixed trying to use @available() on older SDK
Sam Lantinga 97782e6c 2020-11-24T07:11:49 Don't try to call IOS_SupportedHIDDevice() if it's not defined
Sam Lantinga a063b9fb 2020-11-24T07:06:31 Fixed compiler warning
Sam Lantinga c63bbb06 2020-11-24T06:55:33 Including SDL_config_iphoneos.h enables MFI controller code
Sam Lantinga 7a05dbf4 2020-11-24T06:42:53 Fixed building on FreeBSD Alex S Looks like we have a collision with https://hg.libsdl.org/SDL/rev/cd774daff9f6. (Again, the headers in the base system are intended for drivers and should not be used for compiling non-base applications. At least that's the policy for now: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=240964#c19.)
Sam Lantinga feab9d42 2020-11-24T06:40:13 5363 - Memory leak of joystick->sensors in SDL_JoystickClose Mathieu Eyraud Joystick->sensors is never freed.
Sam Lantinga 34bea84a 2020-11-23T23:03:55 Fixed bug 5335 - Patch: enable joystick/haptic/evdev support by default on FreeBSD Alex S Ah, that's not quite enough. You need to: 1. rename src/joystick/bsd/SDL_sysjoystick.c to something; 2. regenerate configure.
Sam Lantinga 1e943e2a 2020-11-23T22:59:22 Fixed building with an older SDK and macOS target
Sam Lantinga e44bf8a0 2020-11-23T21:18:37 Fixed bug 5359 - Incorrect sensor data from DualShock4 multiply gyro values by sensitivity When the hardware calibration fails, values read from sensors need to be multiplied by default sensitivity (16 for gyro, 1 for accelerometer).
Sam Lantinga c8c818d7 2020-11-23T21:14:37 Fixed bug 5360 - non-libudev joystick detection doesn't see controllers that were already connected Simon McVittie When watching for hotplug events we can poll the inotify fd, but we still need to scan /dev/input once per process, otherwise we'll fail to detect devices that were already connected.
Simon McVittie 8e2746cf 2020-11-23T21:10:48 joystick: Don't use udev in Flatpak or pressure-vessel container Flatpak[1] and pressure-vessel[2] are known to use user namespaces, therefore udev event notification via netlink won't work reliably. Both frameworks provide a filesystem API that libraries can use to detect them. Do that, and automatically fall back from udev-based device discovery to the inotify-based fallback introduced in Bug #5337. [1] <https://flatpak.org/> [2] <https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/tree/master/pressure-vessel> Signed-off-by: Simon McVittie <smcv@collabora.com>
Sam Lantinga e9869e07 2020-11-23T21:08:19 Fixed bug 5335 - enable joystick/haptic/evdev support by default on FreeBSD Alex S Evdev headers aren't actually included in the base system (well, it has a private copy), they are available through the devel/evdev-proto port instead. We also have devel/libinotify and devel/libudev-devd shims, I didn't verify whether they work with SDL.
Sam Lantinga 62e39b5f 2020-11-23T20:57:14 Fixed building with an older SDK and macOS target
Sam Lantinga 268aa456 2020-11-23T20:26:28 Fixed compiling with SDL_JOYSTICK_RAWINPUT disabled
Ryan C. Gordon eaa53a19 2020-11-23T22:16:07 joystick: On Linux, don't try to close an invalid inotify file descriptor.
Ryan C. Gordon 5c957747 2020-11-23T22:14:22 joystick: Fix up Linux joystick code to (mostly) compile on FreeBSD.
Sam Lantinga 179bd665 2020-11-23T18:27:43 Don't enable PS5 controller support if DS4Windows is running - they conflict.
Sam Lantinga 5b3616c3 2020-11-23T18:24:05 Generalized the raw input controller driver and moved XInput/WGI detection into it for XInput devices This fixes bad report parsing for various newer Xbox controllers, and this driver is now preferred over XInput, since it handles more than 4 controllers.
Sam Lantinga 2e8e3854 2020-11-21T17:59:15 Fixed compile warning
Sam Lantinga fd894467 2020-11-21T14:13:26 Fixed building on Mac OS X on the command line and with an older macOS SDK
Sam Lantinga 1df593fb 2020-11-21T13:15:33 Fixed bug 5355 - Add GameController Framework support to macOS C.W. Betts This patch adds support to the GameController framework on macOS Big Sur and later, adding support for MFi controllers as well as rumble support for PS4 and Xbox One. There is some code to make sure that the IOKit joystick handler doesn't include two controllers at once. While the GameController framework is present in earlier versions of macOS, there was no public, approved way of checking if a specific IOHIDDevice is a controller that GameController could handle. This was changed in Big Sur.
Sam Lantinga 870841c4 2020-11-21T11:59:01 Reset the LED state after Bluetooth connection has completed on the PS5 controller
Sam Lantinga 549010f2 2020-11-20T13:24:49 It takes 2 packets to stop audio haptics and start emulated rumble on the PS5 controller
Sam Lantinga bf7d198d 2020-11-19T19:09:42 The HORI Fighting Commander should only show up as an XInput Switch Controller on Windows
Sam Lantinga 6cb7f9e3 2020-11-19T19:09:40 Respect SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS for Nintendo Switch Pro controllers using the HIDAPI driver
Sam Lantinga 99807665 2020-11-19T19:09:38 Respect SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS for the Nintendo Switch Pro controller on Linux
Sam Lantinga 7366693f 2020-11-19T19:09:36 Added support for a few more controllers on Linux
Sam Lantinga ffb4d960 2020-11-19T19:09:34 Disabled Xbox protocol debugging
Sam Lantinga c9b097e6 2020-11-19T13:31:16 Clarify the meaning of the rumble enable bits for the PS5 controller
Sam Lantinga c85623d7 2020-11-19T13:10:14 Re-enable haptic audio after rumble on PS5 controller Also make sure we don't set any other state when we're not intending to, and added more interesting effects which are currently not exposed via API
Sam Lantinga 8c3196da 2020-11-18T21:33:11 Fixed some compiler warnings
Sam Lantinga 45f14375 2020-11-18T20:34:12 Experimenting with requesting the serial number on an Xbox One controller
Sam Lantinga 963d8b3f 2020-11-18T20:34:10 Fixed bits in the initial Xbox One protocol ack
Sam Lantinga cd51a51f 2020-11-18T20:34:08 Updated with a better understanding of the Xbox One controller protocol
Sam Lantinga 51ea6a6d 2020-11-17T22:09:52 Don't send controller gyro and accelerometer updates if the values haven't changed. This keeps SDL_PollEvent() from returning data continuously when polling controller state.
Sam Lantinga 463d84a8 2020-11-17T10:56:56 Added support for the PS5 controller gyro and accelerometer
Sam Lantinga fcb21aa8 2020-11-17T10:30:20 Added API for sensors on game controllers Added support for the PS4 controller gyro and accelerometer on iOS and HIDAPI drivers Also fixed an issue with the accelerometer on iOS having inverted axes
Sam Lantinga d140d887 2020-11-16T17:36:47 Added SDL_JoystickGetSerial() and SDL_GameControllerGetSerial()
Sam Lantinga 7bbea0bb 2020-11-16T15:10:02 Fixed build warning
Sam Lantinga 71e32f5e 2020-11-16T15:00:15 Added SDL_crc32()
Sam Lantinga 3d48fc05 2020-11-16T13:21:02 Added notes about the pad lights on the PS5 controller
Sam Lantinga 4514ad57 2020-11-16T13:07:11 Fixed updating LED state when starting application with Bluetooth PS5 controller connected
Sam Lantinga a37e3ae2 2020-11-16T11:21:58 Implemented PS5 effects over Bluetooth
Sam Lantinga c6c116e8 2020-11-16T10:51:13 Implemented setting the LED color on the PS5 controller
Sam Lantinga aa7c3eae 2020-11-16T09:16:01 Fixed size of rumble packet
Sam Lantinga f28c01a4 2020-11-16T09:11:15 Fixed rumble order on PS5
Sam Lantinga eb94c19a 2020-11-16T08:09:15 SDL: fix iOS build
Sam Lantinga 8243bd1d 2020-11-16T08:09:13 SDL: Plumb PS5 rumble to output report
Ozkan Sezer c0f7325b 2020-11-15T17:10:15 SDL_PrivateJoystickForceRecentering: fix wrong loop counter usage. The typo seems to have been added by commit c7782fd6142b
Sam Lantinga 5c34c973 2020-11-13T19:40:25 Clarify that we're using button indices, not using gamepad button names
Sam Lantinga 9f51fad3 2020-11-13T18:01:29 Added support for the touchpad on PS4 and PS5 controllers
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