src/joystick/SDL_joystick.c


Log

Author Commit Date CI Message
Sam Lantinga eb7e29a8 2022-06-17T17:43:14 Fixed crash when the joystick product name isn't available
Sam Lantinga 16f55fbd 2022-06-15T20:44:43 Separate the controller protocol from the controller style This allows us to handle controllers that use the Xbox protocol but look like Nintendo Switch or Playstation controllers, like the Qanba Dragon Arcade Stick in PC mode
Sam Lantinga a9cf313e 2022-06-15T17:28:29 Added the Qanba Obsidian and Dragon Arcade Sticks to the arcade stick list
Sam Lantinga 72fea0ed 2022-06-15T13:58:28 Added support for the Qanba Dragon Arcade Joystick
Sam Lantinga 68544be4 2022-06-10T11:31:59 Added support for the Nintendo Online controllers
Sam Lantinga c7f41038 2022-06-09T13:47:29 Special case for k_eControllerType_XInputSwitchController in the raw input path
Sam Lantinga e6cb0822 2022-06-09T13:20:38 Fixed the default mapping on Windows for the HORI Fighting Commander
Christoph Reichenbach 3a20274d 2022-06-04T20:16:28 Refactoring: move GUID operations out of Joystick - SDL_JoystickGUID -> SDL_GUID (though we retain a type alias) - Operations for GUID <-> String ops are now in src/SDL_guid.c and include/SDL_guid.h - The corresponding Joystick operations delegate to SDL_guid.c - Added test/testguid.c
Sam Lantinga 423141bf 2022-06-03T18:49:41 Added a function to get the controller firmware version
Sam Lantinga b28d304b 2022-05-24T17:24:03 Only include controller_type.h in SDL_joystick.c It has a huge array of controllers and we only want it instantiated once
Sam Lantinga b1cf3229 2022-05-19T16:49:47 Fixed HIDAPI PS4 controller being picked up when running under Steam Input with PS4 configuration enabled
Sam Lantinga 48b6cd8b 2022-05-16T07:23:30 Fixed whitespace
Sam Lantinga 94eeb587 2022-05-15T20:01:12 First pass at extending virtual controller functionality Added the ability to specify a name and the product VID/PID for a virtual controller Also added a test case to testgamecontroller, if you pass --virtual as a parameter
Sam Lantinga e551384a 2022-04-26T14:54:14 Added functions to get the platform dependent name for a joystick or game controller
meyraud705 3dcfe860 2022-02-02T13:59:49 Add joystick battery event
Kimplul 2398c43b 2022-03-24T14:34:37 add some Thrustmaster wheels
Ryan C. Gordon 4fe7b2cb 2022-03-24T11:00:43 static analysis: Fixed several complaints from codechecker. There are still some pending Objective-C specific issues. Reference issue #4600.
Sam Lantinga 1868c5b5 2022-03-17T18:25:50 Start rumbling once a raw input controller has been correlated Fixes https://github.com/libsdl-org/SDL/issues/5351
Sam Lantinga bcb0f1de 2022-03-17T08:52:31 Fixed build when events are disabled Fixes https://github.com/libsdl-org/SDL/issues/5413
Sam Lantinga 1b766937 2022-03-08T09:58:24 Fixed the SDL controller type for USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER
Sam Lantinga af40cb6f 2022-02-23T15:49:10 Added support for the Razer Huntsman Analog keyboard in controller mode
Sam Lantinga 18032979 2022-02-15T13:07:51 Added the hint SDL_HINT_JOYSTICK_ROG_CHAKRAM to control whether ROG Chakram mice show up as joysticks This hint defaults off, but when it is enabled the mice will have a game controller mapping set up for Profile 3 (set in the Armoury Crate software)
Joshua Ashton 86b7a064 2022-02-04T16:40:05 Add additional VID/PIDs for Anne Pro II This thing changes its VID/PID on firmware revisions...
Vitaliy Zhmurikov 5b744592 2022-01-28T06:11:28 Update SDL_joystick.c Add Logitech Momo Racing Wheel VID & PID to SDL_IsJoystickProductWheel function
Cameron Gutman 419ae29d 2022-01-03T21:44:18 joystick: Move WGI driver initialization after Windows driver WGI calls SDL_DINPUT_JoystickPresent() so we need to be sure DInput remains initialized for the lifetime of the WGI driver to avoid a crash or duplicated joysticks between DInput and WGI.
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Ozkan Sezer 82fc67ae 2021-12-18T14:01:02 SDL_joystick.c: cast the arguments to nibble() to unsigned char.
Ozkan Sezer 47d3e96b 2021-12-18T14:01:02 SDL_joystick.c: (unsigned char) cast to SDL_tolower() parameters.
Sam Lantinga a6cbe0ab 2021-11-27T10:58:12 Controllers are always centered at zero using XInput and WGI
Sam Lantinga d8618204 2021-11-26T07:57:19 SDL_JoystickGetAttached() doesn't need to be noisy for NULL joystick Fixes https://github.com/libsdl-org/SDL/issues/5008
Cameron Gutman 1237142b 2021-11-18T19:52:34 joystick: Quit drivers in reverse order to ensure dependencies are not broken SDL_WINDOWS_JoystickDriver depends on callbacks in SDL_RAWINPUT_JoystickDriver and SDL_HIDAPI_JoystickDriver being available. It also manages the common WindowProc used for joystick detection in both WINDOWS and RAWINPUT drivers. If we don't tear them down backwards, there's a window of time where we could invoke RAWINPUT_WindowProc() after RAWINPUT_JoystickQuit() was called.
Cameron Gutman fe09a493 2021-11-11T15:53:11 joystick: Add APIs to query rumble support
Cameron Gutman 1ccfbf96 2021-11-11T11:13:08 joystick: Convert HasLED() into a generic GetCapabilities() function
Sam Lantinga 7681929c 2021-11-09T12:30:37 Don't send the initial joystick axis event if the application is in the background
Sam Lantinga d31f90d9 2021-11-09T12:09:01 Don't send game controller touchpad or sensor events unless the application has focus Fixes https://github.com/libsdl-org/SDL/issues/4891
Sam Lantinga 26706319 2021-10-30T05:53:12 Ignore the ASRock LED controller, it's not a joystick
Sam Lantinga a43d3f69 2021-10-20T15:19:22 Don't detect the ROG Chakram mouse as a joystick
Sam Lantinga 9706feac 2021-10-01T15:11:25 Update length after shortening string (thanks mayraud705!) Closes https://github.com/libsdl-org/SDL/pull/4698
Sam Lantinga 441fbcaa 2021-08-13T20:48:54 Added HIDAPI support for the Xbox Adaptive Controller
Sam Lantinga 907943a2 2021-08-12T17:51:08 Added support for the Xbox One S Controller with 5.x series firmware
Sam Lantinga 64882b24 2021-08-12T08:17:08 Added support for the Xbox One Elite 2 Controller with 5.x series firmware
Sam Lantinga 9fdb0645 2021-08-04T11:33:28 Added support for the Joy-Con Charging Grip when SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS is enabled
Sam Lantinga 16010f75 2021-07-30T18:23:43 Added support for the PowerA Nintendo Switch Fusion Arcade Stick
Sam Lantinga b33f4709 2021-07-30T18:23:42 Fixed detection of the PDP Afterglow Wireless Switch Controller over Bluetooth
Sam Lantinga 6af6950d 2021-07-30T18:23:42 Added support for the Victrix Gambit Tournament Controller
Sam Lantinga 243a8836 2021-07-30T18:23:41 The PowerA Nintendo Switch Fusion Pro Controller has a working USB mode, enabled via the switch on the underside of the controller.
Sam Lantinga a186a503 2021-07-29T06:43:39 Added SDL_GameControllerGetSensorDataRate() to get the sensor update rate for a controller.
Sam Lantinga 10ec4c86 2021-07-24T22:11:22 Added support for the PowerA Nintendo Switch Spectra Controller
Sam Lantinga 94b7a876 2021-07-24T09:10:18 Added SDL_GameControllerType enumerations for the Amazon Luna and Google Stadia controllers Fixes bug https://github.com/libsdl-org/SDL/issues/4019
Sam Lantinga 669714ca 2021-07-23T23:51:35 Added the ThrustMaster T.16000M as a flightstick
Sam Lantinga 422b053b 2021-07-23T16:32:35 Added support for the full line of current PowerA Xbox Series X controllers
Sam Lantinga d135c076 2021-07-08T13:22:41 Added SDL_GameControllerSendEffect() and SDL_JoystickSendEffect() to allow applications to send custom effects to the PS4 and PS5 controllers See testgamecontroller.c for an example of a custom PS5 trigger effect
Sam Lantinga 24e836b0 2021-07-06T10:00:09 Added controller mapping for the Nimbus+ controller on macOS when MFi support is not available
Joshua Ashton ca383599 2021-06-27T01:49:31 Fix Anne Pro II keyboard showing up as a joystick Having used this for a couple years, I can definitely confirm that it is not a joystick.
Sam Lantinga afd100f0 2021-06-18T17:37:46 Added support for the PowerA Fusion Pro 2 and the PDP Xbox Series X Afterglow and Blue controllers
Sam Lantinga d8dba5bc 2021-06-17T11:22:08 Added support for the Logitech G923 racing wheel
Paul Cercueil f3cf019e 2021-06-12T13:25:34 joystick: Add missing comma in joystick drivers list Without this comma it is impossible to enable both the Vita and Dummy drivers at the same time. Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Timo Gurr b63cb822 2021-05-30T01:57:56 Added T500RS to known wheel list
Kimplul 9e1d7bae 2021-05-12T17:43:39 Added T300RS to known wheel list
Sam Lantinga 2a20cc0f 2021-04-12T11:25:42 SDL: let through a SetLED command every 5sec to deall with situations where the controller loses power when a computer is suspended CR: SamL
Sam Lantinga 3377861a 2021-03-26T11:57:19 Added support for the Amazon Game Controller to the HIDAPI driver
Ivan Epifanov 73b545ed 2020-11-02T19:38:20 Fix joystick support
Sam Lantinga 1f7ec3fa 2021-02-11T17:27:22 Added support for the PowerA Xbox One Series X Wired Controller
Cameron Gutman f4d58689 2021-02-03T18:00:22 Fix Xbox Series X controller on macOS There were two different implementations of IsBluetoothXboxOneController(), one in SDL_hidapi_xbox360.c and one in SDL_hidapi_xboxone.c. The latter had been updated to include USB_PRODUCT_XBOX_ONE_SERIES_X_BLUETOOTH while the former had not. This mismatch led to the Xbox Series X failing on macOS only. We have special code for handling the 360Controller driver for macOS which requires us to use the Xbox 360 driver for wired Xbox One controllers, and the SDL_hidapi_xbox360 version of IsBluetoothXboxOneController() was used to determine which devices were wired. In addition to adding the missing USB_PRODUCT_XBOX_ONE_SERIES_X_BLUETOOTH, this change moves IsBluetoothXboxOneController() into a single shared function which will ensure this bug won't happen again.
Sam Lantinga 85235985 2021-02-02T11:53:31 Fixed detecting the paddles on the Xbox Elite Series 1 controller
Sam Lantinga 7e19c634 2021-01-28T14:53:59 Note that the Logitech G29 (PS4) is a racing wheel
JibbSmart 0f57864c 2021-01-18T19:57:29 Hint SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS added so we can recognise a Joy-Con as half a Pro Controller, so we can read its analog input and read its sensors just like we do a Pro Controller.
Ozkan Sezer fd65aaa9 2021-01-23T17:30:50 move outdated winmm and psp joystick codes to struct _SDL_JoystickDriver build-tested only. (bug #5472.)
Ozkan Sezer 4a776557 2021-01-22T20:10:02 old os2 analogue joystick code ported from SDL-1.2. disabled by default, build-tested only.
Sam Lantinga 178ae70a 2021-01-20T12:18:10 Don't add paddle mappings for the Xbox One Elite Series 1 controller, since they can't be unmapped and read directly on that controller.
Sam Lantinga b2a0c712 2021-01-04T12:24:44 Allow setting the player index to -1, which turns off the player LED for PS5 controllers
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sam Lantinga cb361896 2020-12-09T07:16:22 Fixed bug 5235 - All internal sources should include SDL_assert.h Ryan C. Gordon We should really stick this in SDL_internal.h or something so it's always available.
Sam Lantinga 3c07dd12 2020-11-25T10:28:48 Strip an extra '.' off of the HORI manufacturer name
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 feab9d42 2020-11-24T06:40:13 5363 - Memory leak of joystick->sensors in SDL_JoystickClose Mathieu Eyraud Joystick->sensors is never freed.
Sam Lantinga 62e39b5f 2020-11-23T20:57:14 Fixed building with an older SDK and macOS target
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 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 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
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 9f51fad3 2020-11-13T18:01:29 Added support for the touchpad on PS4 and PS5 controllers
Sam Lantinga 1e2caac5 2020-11-11T18:57:37 Added SDL_JoystickRumbleTriggers() and SDL_GameControllerRumbleTriggers()
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 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 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.
Cameron Gutman 9d40a0f3 2020-08-29T16:50:26 Fix joystick device add events containing invalid device indexes This can happen if the application has not yet processed SDL_JOYDEVICEADD when the same joystick is removed. It may also happen if two joysticks are added and the second joystick is removed before the first joystick's SDL_JOYDEVICEADD has been processed by the application.
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
Ethan Lee 83cddd2e 2020-04-30T11:57:29 Add SDL_JoystickSetLED. Currently, this is only supported by the PS4 HIDAPI driver.
Brendan Shanks 032fa681 2020-04-24T14:03:30 Add Logitech G29 to steering wheel list
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
Ryan C. Gordon 8c165add 2020-04-07T23:17:27 joystick: Remove force_centering flag; we handle this on disconnect now.
Ryan C. Gordon 07f231ee 2020-03-26T18:47:04 joystick: Make sure recentering events happen before disconnect events. Fixes Bugzilla #5063.
Sam Lantinga 4dea340c 2020-03-16T12:23:38 Fixed bug 4477 - Support more than 4 XInput-capable devices on Windows Jimb Esser Add new RawInput controller API, and improved correlation with XInput/WGI Reorder joystick init so drivers can ask the others if they handle a device reliably Do not poll disconnected XInput devices (major perf issue) Fix various cases where incorrect correlation could happen Simple mechanism for propagating unhandled Guide button presses even before guaranteed correlation Correlate by axis motion as well as button presses Fix failing to zero other trigger Fix SDL_HINT_JOYSTICK_HIDAPI not working if set before calling SDL_Init() Add missing device to device names Disable RawInput if we have a mismatch of XInput-capable but not RawInput-capable devices Updated to SDL 2.0.13 code with the following notes: New HID driver: xbox360w - no idea what that is, hopefully urelated SDL_hidapijoystick.c had been refactored to couple data handling logic with device opening logic and device lists caused some problems, yields slightly uglier integration than previously when the 360 HID device driver was just handling the data. SDL_hidapijoystick.c now often pulls the device off of the joystick_hwdata structure for some rumble logic, but it appears that code path is never reached, so probably not a problem. Looks like joystick_hwdata was refactored to not include a mutex in other drivers, maintainers may want to do the same refactor here if that's useful for some reason. Something changed in how devices get names, so getting generic names. Had to fix a (new?) bug where removing an XInput controller caused existing controllers (that moved to a new XInput index) to get identified as 0x045e/0x02fd ("it's probably Bluetooth" in code), rendering the existing HIDAPI_IsDevicePresent and new RAWINPUT_IsDevicePresent unreliable.