Commit Graph

204 Commits

Author SHA1 Message Date
Sam Lantinga
45f1437549 Experimenting with requesting the serial number on an Xbox One controller 2020-11-18 20:34:12 -08:00
Sam Lantinga
963d8b3f40 Fixed bits in the initial Xbox One protocol ack 2020-11-18 20:34:10 -08:00
Sam Lantinga
cd51a51f00 Updated with a better understanding of the Xbox One controller protocol 2020-11-18 20:34:08 -08:00
Sam Lantinga
463d84a860 Added support for the PS5 controller gyro and accelerometer 2020-11-17 10:56:56 -08:00
Sam Lantinga
fcb21aa883 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
2020-11-17 10:30:20 -08:00
Sam Lantinga
d140d88744 Added SDL_JoystickGetSerial() and SDL_GameControllerGetSerial() 2020-11-16 17:36:47 -08:00
Sam Lantinga
71e32f5e1b Added SDL_crc32() 2020-11-16 15:00:15 -08:00
Sam Lantinga
3d48fc05c3 Added notes about the pad lights on the PS5 controller 2020-11-16 13:21:02 -08:00
Sam Lantinga
4514ad573e Fixed updating LED state when starting application with Bluetooth PS5 controller connected 2020-11-16 13:07:11 -08:00
Sam Lantinga
a37e3ae218 Implemented PS5 effects over Bluetooth 2020-11-16 11:21:58 -08:00
Sam Lantinga
c6c116e847 Implemented setting the LED color on the PS5 controller 2020-11-16 10:51:13 -08:00
Sam Lantinga
aa7c3eae19 Fixed size of rumble packet 2020-11-16 09:16:01 -08:00
Sam Lantinga
f28c01a4fb Fixed rumble order on PS5 2020-11-16 09:11:15 -08:00
Sam Lantinga
eb94c19a63 SDL: fix iOS build 2020-11-16 08:09:15 -08:00
Sam Lantinga
8243bd1dc6 SDL: Plumb PS5 rumble to output report 2020-11-16 08:09:13 -08:00
Sam Lantinga
5c34c973e6 Clarify that we're using button indices, not using gamepad button names 2020-11-13 19:40:25 -08:00
Sam Lantinga
9f51fad361 Added support for the touchpad on PS4 and PS5 controllers 2020-11-13 18:01:29 -08:00
Sam Lantinga
78422fa3c8 Added more detail on the PS5 controller state packet and enable full reports over Bluetooth 2020-11-13 13:17:07 -08:00
Sam Lantinga
5b0d432942 Implemented trigger rumble in the HIDAPI Xbox One driver 2020-11-12 07:53:03 -08:00
Sam Lantinga
83b653d55d Fixed build warning 2020-11-11 20:09:56 -08:00
Sam Lantinga
320a7587d7 Fixed compiler warnings 2020-11-11 19:26:59 -08:00
Sam Lantinga
1e2caac58b Added SDL_JoystickRumbleTriggers() and SDL_GameControllerRumbleTriggers() 2020-11-11 18:57:37 -08:00
John "Nielk1" Klein
067630aef3 Fix hidapi for unhandled DS4 headset microphone data corrupting controller state 2020-11-11 03:47:08 -06:00
Sam Lantinga
d1e10c313e Removed debug output 2020-11-11 14:38:14 -08:00
Sam Lantinga
e12457d8bf Added support for the Xbox Series X controller to the HIDAPI driver 2020-11-10 12:26:30 -08:00
Sam Lantinga
c3dea23120 Added support for reading the paddles on a Xbox Elite Series 2 controller in Bluetooth mode 2020-11-09 22:39:33 -08:00
Sam Lantinga
1577366c36 Fixed duplicated switch statement processing Xbox controller dpad state 2020-11-08 23:49:03 -08:00
Bart van der Werf
3d92e8c742 hidapi: Also parse data[12] with dpad values on the xb1s controller 2020-10-21 10:43:46 -04:00
Sam Lantinga
009b62f1c2 Be explicit about mapping the new game controller paddle buttons 2020-11-07 02:22:15 -08:00
Sam Lantinga
3a3aaac221 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
2020-11-06 11:30:52 -08:00
Sam Lantinga
a22beef402 Moved the PS5 controller driver to a separate file, as the advanced feature protocol is very different from that of the PS4 2020-11-05 17:03:28 -08:00
Sam Lantinga
4d79f9662f Added initial support for the Sony PS5 Controller 2020-11-05 15:02:54 -08:00
Sam Lantinga
e555d45331 Added SDL_JoystickHasLED
Currently, this is only supported by the PS4 HIDAPI driver.
2020-11-05 11:07:54 -08:00
Ethan Lee
83cddd2ebc Add SDL_JoystickSetLED.
Currently, this is only supported by the PS4 HIDAPI driver.
2020-04-30 11:57:29 -04:00
Cameron Gutman
134362e745 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
2020-04-25 19:15:51 -07:00
Sam Lantinga
d000c1cd6d 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.
2020-05-29 21:22:11 -07:00
Sam Lantinga
345b4d7e14 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.
2020-05-29 13:37:21 -07:00
Ryan C. Gordon
5fe34a4079 hidapi: Fix compiler warning. 2020-05-20 17:01:25 -04:00
Sam Lantinga
b90b59279e Added support for the Razer Atrox Arcade Stick 2020-04-17 21:30:58 -07:00
Sam Lantinga
dbcda0b212 Added support for the Razer Wolverine Ultimate 2020-04-17 21:30:56 -07:00
Sam Lantinga
2b32385502 Don't send rumble packets too quickly to Nintendo Switch Pro controllers over Bluetooth 2020-04-17 15:08:48 -07:00
Sam Lantinga
c02f54a0ed Fixed the default face button mapping for Nintendo Switch Pro controllers 2020-04-17 15:08:46 -07:00
Sam Lantinga
50b1c19549 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) {
2020-04-14 09:55:33 -07:00
Sam Lantinga
f34d2c60cc Added zlib license for Steam Controller headers 2020-04-14 07:35:35 -07:00
Sam Lantinga
55515a8c25 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. 2020-04-08 08:42:15 -07:00
Sam Lantinga
b6afbe6317 Added SDL_log.h to SDL_internal.h so logging is available everywhere 2020-04-07 09:38:57 -07:00
Sam Lantinga
3154d92473 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
2020-03-30 14:26:21 -07:00
Sam Lantinga
cb8c91d956 Fixed bug 5051 - Switch Pro Controller hidapi driver does not report battery levels when connected via Bluetooth
bluenaxela+sdl

I've noticed that the Switch Pro Controller hidapi driver does not report battery levels when connected via Bluetooth, despite having code for setting joystick->epowerlevel.

This is caused by the driver always using k_eSwitchInputReportIDs_SimpleControllerState via Bluetooth. Using that mode means that the state reports you get back from the controller do not include battery state. Not using the full controller state over Bluetooth effectively makes this driver's support for setting joystick->epowerlevel entirely pointless, only ever reporting SDL_JOYSTICK_POWER_WIRED.

Is there a reason this was set to only use SimpleControllerState via Bluetooth?

I've attached a patch I'm using to allow getting battery level for the Switch Pro Controller.

A couple notes about this patch:
1) It changes LoadStickCalibration to accept the input_mode that is selected, because that's really what should determine what is used for stick extents, since stick extents differ between the modes.
2) In my patch I only use FullControllerState when the vid/pid matches the official Switch Pro Controller, as a cautionary measure in case some third-party controllers have problems with FullControllerState mode via Bluetooth (I noticed a HORI Wireless Switch Pad I had seemed to not read controller calibration correctly for stick extents. Maybe it's calibration data was uninitialized on account of having never been used with a Switch? I'm unsure, though if that guess is right maybe SDL2 should be detecting an uninitiated calibration state and using some sensible defaults)
2020-03-22 11:01:14 -07:00
Sam Lantinga
f55cbdfd96 Allow Valve devices in driver check, we know they're well behaved controllers 2020-03-20 21:05:07 -07:00
Sam Lantinga
106ffd57d8 Fixed bug 5049 - HORI Wireless Switch Pad does not connect properly via Bluetooth
bluenaxela+sdl

The HORI Wireless Switch Pad does not properly connect via bluetooth. I did some debugging and found that the code that tries to control the Home LED causes this controller to disconnect.
2020-03-20 20:45:30 -07:00