src/joystick/hidapi


Log

Author Commit Date CI Message
Sam Lantinga 9e45372a 2021-01-21T22:47:37 Fixed build on Android and iOS
Sam Lantinga f68b36df 2021-01-22T11:42:42 Added support for the EVORETRO GameCube Adapter in PC mode
Sam Lantinga 3527b494 2021-01-21T22:30:34 Fixed initializing the Nyko and EVORETRO GameCube adaptors This requires root on most Linux distributions, as we have to directly send USB messages to the devices to enable input reports.
Cameron Gutman 6e97170e 2021-01-08T21:16:06 Use PS4 rumble hint as the default for the PS5 rumble hint Existing SDL applications may not know about the need to set a specific hint to enable rumble on PS5 controllers, even though they may already set the equivalent SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE hint for PS4 controller rumble support. Rather than requiring those developers update their apps, let's use the SDL_HINT_JOYSTICK_HIDAPI_PS4_RUMBLE value as an indication of the behavior they are expected for all PlayStation controllers.
Ozkan Sezer bdb3e6b8 2021-01-15T12:40:00 SDL_hidapi_switch.c: fix build with older compilers
Sam Lantinga e3dbae50 2021-01-14T23:49:41 Get the serial number for the Nintendo Switch Pro controller
Sam Lantinga 5fc743c4 2021-01-14T23:49:37 Phantom Nintendo Switch Pro Controller initialization problem
Sam Lantinga 92742306 2021-01-14T23:49:33 Fixed rumble reset failing for Switch Pro controllers in USB mode
Sam Lantinga d0b87fed 2021-01-14T23:49:27 Added HIDAPI rumble debug info
Sam Lantinga e2f46ed8 2021-01-14T23:49:20 Always lock the HIDAPI device when closing, in case rumble is pending
Sam Lantinga 907b8eeb 2021-01-14T23:49:16 Make sure the HIDAPI device is locked when closing it, in case there is rumble pending that didn't complete
Sam Lantinga fbd7c718 2021-01-13T11:02:07 Don't blink the Xbox 360 LED when setting the player slot, it's probably already been set by a driver
Sam Lantinga d757ec7f 2021-01-13T11:02:01 Only select the gamepad interfaces on the Xbox 360 wireless adapter
JibbSmart e9887045 2021-01-11T15:36:40 Gyro and Accel sensor support for Switch Pro Controller. Note that axes are changed to match the axes we're using with PlayStation controllers, since users will appreciate consistent behaviour across devices.
Sam Lantinga a5dba7d3 2021-01-08T09:54:52 Fixed Xbox One Series X share button incorrectly triggering on newer firmware
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 bf754b52 2021-01-04T12:17:24 Valve contributed code is under the Zlib license
Sam Lantinga 9130f7c3 2021-01-02T10:25:38 Updated copyright for 2021
Sam Lantinga 480c1f9f 2021-01-01T11:12:36 Make sure we're not starving report reads when there's lots of rumble
Sam Lantinga 0684572c 2020-12-29T12:13:10 Added a hint to control whether the player LEDs should be lit to indicate which player is associated with a PS5 controller.
Sam Lantinga 0ed4d929 2020-12-23T04:53:23 Fixed setting player LEDs for PS5 controllers over Bluetooth
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 c93947a2 2020-12-22T20:12:03 Make it possible to turn on PS5 rumble effects at runtime using the hint
Sam Lantinga 058a0ab4 2020-12-22T14:38:32 Set the pad lights on the PS5 controller corresponding to the player index Also allow setting the player index from testgamecontroller using the number keys
Sam Lantinga 6a57072e 2020-12-22T14:10:08 Only add the touchpad and sensors to the PS5 controller if effects are enabled
Sam Lantinga 4ec776c3 2020-12-22T13:29:23 Don't switch the PS5 controller out of DirectInput mode by default
Sam Lantinga e65e4fd3 2020-12-14T09:48:51 Fixed detecting the guide button on Xbox One S controllers over Bluetooth on Linux
Sam Lantinga 80e5c689 2020-12-13T01:20:38 Fixed the PS5 controller not disconnecting when powered off
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 c9723c40 2020-12-07T09:38:21 Fixed potential hang in joystick close if the rumble thread is blocked for some reason It's still possible to hang when shutting down, if the rumble thread is still hung, but it won't block indefinitely at runtime.
Sam Lantinga 09909d02 2020-12-03T19:44:47 Fixed handling of BACK button on newer Xbox One S controllers
Sam Lantinga 54e5136b 2020-12-03T18:17:04 Refactored Xbox One Bluetooth protocol and verified Xbox One S, Xbox Series X, and Xbox One Elite Series 2 controllers
Sam Lantinga 1031231b 2020-12-03T18:17:03 Fixed duplicating a device between XInput and HIDAPI
Sam Lantinga 59f28b7f 2020-12-03T18:17:01 Fixed whitespace
Sam Lantinga e3966e25 2020-11-30T13:04:30 Use the correct internal API for updating the battery level for PS5 controllers
Sam Lantinga f4ed07de 2020-11-30T13:02:34 We don't know whether the PS5 controller is Bluetooth or not when we open it
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 ce77966d 2020-11-27T10:44:49 Fixed RAWINPUT_IsDevicePresent() not returning TRUE for Xbox One 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 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 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 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 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 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 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
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 5b0d4329 2020-11-12T07:53:03 Implemented trigger rumble in the HIDAPI Xbox One driver
Sam Lantinga 83b653d5 2020-11-11T20:09:56 Fixed build warning
Sam Lantinga 320a7587 2020-11-11T19:26:59 Fixed compiler warnings
Sam Lantinga 1e2caac5 2020-11-11T18:57:37 Added SDL_JoystickRumbleTriggers() and SDL_GameControllerRumbleTriggers()
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 1577366c 2020-11-08T23:49:03 Fixed duplicated switch statement processing Xbox controller dpad state
Sam Lantinga 009b62f1 2020-11-07T02:22:15 Be explicit about mapping the new game controller paddle buttons
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 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.
Bart van der Werf 3d92e8c7 2020-10-21T10:43:46 hidapi: Also parse data[12] with dpad values on the xb1s controller
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 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.
Ryan C. Gordon 5fe34a40 2020-05-20T17:01:25 hidapi: Fix compiler warning.
Ethan Lee 83cddd2e 2020-04-30T11:57:29 Add SDL_JoystickSetLED. Currently, this is only supported by the PS4 HIDAPI driver.
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
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
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 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
Sam Lantinga cb8c91d9 2020-03-22T11:01:14 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)