src/joystick/hidapi/SDL_hidapi_ps4.c


Log

Author Commit Date CI Message
Sam Lantinga 5b646cd1 2021-11-07T22:58:44 Build hidapi code into SDL as a new public API This prevents conflicts with hidapi linked with applications, as well as allowing applications to make use of HIDAPI on Android and other platforms that might not normally have an implementation available.
Sam Lantinga a186a503 2021-07-29T06:43:39 Added SDL_GameControllerGetSensorDataRate() to get the sensor update rate for a controller.
Sam Lantinga 384d86b5 2021-07-23T23:48:23 Fixed compile warnings with Visual Studio
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 e2f46ed8 2021-01-14T23:49:20 Always lock the HIDAPI device when closing, in case rumble is pending
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sam Lantinga 6341bb35 2020-12-22T21:51:59 Fixed controller disconnect detection for PS4 and PS5 controllers over Bluetooth
Sam Lantinga a30adae5 2020-12-22T20:58:32 Make it possible to turn on PS4 rumble effects at runtime using the hint
Sam Lantinga 59f28b7f 2020-12-03T18:17:01 Fixed whitespace
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 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 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 71e32f5e 2020-11-16T15:00:15 Added SDL_crc32()
Sam Lantinga c6c116e8 2020-11-16T10:51:13 Implemented setting the LED color on the PS5 controller
Sam Lantinga f28c01a4 2020-11-16T09:11:15 Fixed rumble order on PS5
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()
John "Nielk1" Klein 067630ae 2020-11-11T03:47:08 Fix hidapi for unhandled DS4 headset microphone data corrupting controller state
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 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.
Ethan Lee 83cddd2e 2020-04-30T11:57:29 Add SDL_JoystickSetLED. Currently, this is only supported by the PS4 HIDAPI driver.
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.
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
Jimb Esser 47da53b9 2020-03-16T14:49:20 Fix compiler warnings
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.
Cameron Gutman 467434b9 2020-03-07T13:17:28 Added support for indicating player index on DS4 controllers
Sam Lantinga 1684606f 2020-02-04T15:26:56 Fixed long delay on main thread caused by blocking rumble writes in HIDAPI drivers There is now a thread that handles all HIDAPI rumble requests and a lock that guarantees that we're not reading and writing the device at the same time.
Sam Lantinga 6efebf17 2020-02-04T12:48:53 Moved rumble expiration to the main joystick handling level, and prevent sending the driver layer duplicate rumble requests.
Sam Lantinga 9c3d1602 2020-01-19T11:43:36 Refactored code so SDL_GetJoystickGameControllerType() is called less during controller detection
Sam Lantinga 43aa1fa9 2020-01-18T11:21:14 Added support for detecting previously unknown Xbox 360 and Xbox One controllers using the HIDAPI driver with libusb and Android
Sam Lantinga a8780c6a 2020-01-16T20:49:25 Updated copyright date for 2020
Sam Lantinga 46e1377d 2019-12-20T20:12:03 Automatically assign player indexes to game controllers, and allow changing the player index for game controllers and joysticks. Added the functions SDL_JoystickFromPlayerIndex(), SDL_JoystickSetPlayerIndex(), SDL_GameControllerFromPlayerIndex(), and SDL_GameControllerSetPlayerIndex()
Sam Lantinga 1db56619 2019-12-19T18:03:28 Fixed rare infinite rumble in HIDAPI controller driver
Sam Lantinga e7f7e3f4 2019-12-19T15:01:30 Refactored HIDAPI controller code to support dongles and hubs that dynamically attach controllers
Sam Lantinga a7ae9175 2019-12-16T10:20:03 Fixed bug 4898 - No rumble because of integer overflow in SDL_JoystickRumble meyraud705 On a Dualshock 4 controller using hidapi driver, calling SDL_JoystickRumble with a duration too long (SDL_HAPTIC_INFINITY for example) causes the rumble to stop immediately. This happens because of integer overflow on line 301 of SDL_hidapi_ps4.c (https://hg.libsdl.org/SDL/file/a3077169ad23/src/joystick/hidapi/SDL_hidapi_ps4.c#l301), which sets expiration time in the past.
Sam Lantinga 733f2525 2019-11-22T14:09:24 Fixed build
Sam Lantinga b5aff9d7 2019-11-22T13:12:12 Added SDL_GameControllerTypeForIndex() and SDL_GameControllerGetType() to return the type of controller attached.
Sam Lantinga 9da4bfc1 2019-10-22T10:57:07 Added support for the Power A Nintendo Switch Enhanced Wireless Controller
Sam Lantinga 3b3dbb5a 2019-10-01T08:50:04 Removed unused volume check interval
Sam Lantinga cbde0ffa 2019-09-19T16:50:49 The PS4 is ignoring the volume values in the report, so we don't need to fill them in.
Sam Lantinga be6cda9f 2019-06-19T15:54:21 Rolling back GameCube HIDAPI support It causes the HIDAPI devices to always be opened on enumeration, which causes crashes in the Windows drivers when multiple applications are reading and writing at the same time. We can revisit this after 2.0.10 release.
Sam Lantinga d97387cc 2019-06-08T14:32:19 Fixed bug 4600 - Dualshock 4 touchpad press is not detectable with SDL_JoystickGetButton Dexter Friedman When using a Dualshock 4 controller (model numbers CUH-ZCT1U and CUH-ZCT2U), pressing anywhere on the center touchpad does not send an SDL_JOYBUTTONDOWN event. I have verified this with testjoystick: Repro steps: 1. Plug in a DS4 over USB 2. Compile testjoystick and run: testjoystick.exe 0 3. Press and hold the touchpad. Observe that no lime green box appears Expected behavior: A lime green box appears while the touchpad is pressed. Notes: I've attached a patch here that works on my PC and produces the expected behavior in testjoystick, for both DS4 model numbers I listed earlier. If I understand correctly, by exposing this as a joystick button, the gamecontroller API mapping can be modified with a change to gamecontrollerdb.txt in the future.
Zack Middleton 82af4276 2019-06-08T13:36:59 hidapi: Use GameCube adapter controller port for player index The Nintendo USB GameCube adapter has four controller ports. Return the port number as 0 to 3 from SDL_JoystickGetPlayerIndex() and SDL_JoystickGetDevicePlayerIndex().
Ethan Lee c5286156 2019-03-12T20:27:54 hidapi: Add support for Wii U/Switch USB GameCube controller adapter. Note that a single USB device is responsible for all 4 joysticks, so a large rewrite of the DeviceDriver functions was necessary to allow a single device to produce multiple joysticks.
Sam Lantinga 5e13087b 2019-01-04T22:01:14 Updated copyright for 2019
Ozkan Sezer fde82e59 2018-09-28T14:01:40 SDL_hidapi_ps4.c: add HAVE_ENDPOINTVOLUME_H check to win32 volume code. this makes it build with my old toolchain with mingw-w64 1.0.10 headers
Sam Lantinga f964ce03 2018-09-28T01:00:47 Fixed mingw-w64 build
Sam Lantinga 80021c21 2018-09-05T15:28:06 Speculatively disable rumble on the Razer Panthera Evo, which doesn't have rumble motors and probably hangs in the same way the Panthera does.
Sam Lantinga c152e380 2018-09-05T11:18:50 Added support for the Razer Panthera Fightstick Fixed bindings for the Mad Catz FightStick TE S+
Sam Lantinga 34237b80 2018-08-31T18:10:21 Better fix to make sure we're only returning controllers from the HIDAPI joystick API
Sam Lantinga 5ef8eb49 2018-08-29T20:55:02 Don't show the Razer Raiju sound interface as a game controller
Sam Lantinga 207428b4 2018-08-29T20:23:39 Don't rumble Bluetooth PS4 controllers by default, as that switches the controller into extended input report mode, which breaks games that use DirectInput.
Ozkan Sezer 90454b1e 2018-08-16T11:01:02 SDL_hidapi_ps4.c: define NTDDI_VISTA / _WIN32_WINNT_VISTA if not defined it still needs a Vista or newer Platform SDK to build, though.
Sam Lantinga 63107524 2018-08-15T19:53:34 Fixed input from the Steam Virtual Gamepad on Mac OS X
Sam Lantinga 51902010 2018-08-15T19:53:26 Remove the HIDAPI device if we get a read error from it This fixes detecting PS4 controller disconnect on Mac OS X, where there isn't any device removed notification
Ozkan Sezer a7c3d2af 2018-08-10T11:50:55 SDL_hidapi_ps4.c: lowercase windows header names.
Sam Lantinga 31b02243 2018-08-09T16:04:45 Added notes that this code was contributed by Valve
Sam Lantinga d2042e1e 2018-08-09T16:00:17 Added HIDAPI joystick drivers for more consistent support for Xbox, PS4 and Nintendo Switch Pro controller support across platforms. Added SDL_GameControllerRumble() and SDL_JoystickRumble() for simple force feedback outside of the SDL haptics API