src/joystick/hidapi


Log

Author Commit Date CI Message
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.
Phillip Stephens 94d43186 2022-02-22T00:41:15 GameCubeAdapter: Add suppport for all rumble modes This adds support for all 3 of the gamecube controller's rumble modes Rumble: 1 Stop: 0 StopHard: 2 This is useful for applications that need the full range of support This also adds a hint to control rumble behavior, defaults 0 to maintain compatibility
pionere 60deadba 2022-01-17T17:22:30 re-use return value of SDL_SetError/WIN_SetErrorFromHRESULT/SDL_OutOfMemory
Sam Lantinga b06866ef 2022-01-16T09:44:28 Entirely remove Xbox axis filtering, we don't want this at all.
Sam Lantinga 09aed102 2022-01-16T09:23:58 Don't send output reports to the Victrix Pro FS v2 It'll hang on reboot if it gets output reports, and it doesn't have functionality that requires them, so skip it.
Sam Lantinga 85961b61 2022-01-16T09:01:56 Disable Xbox axis deadzone handling by default Fixes https://github.com/libsdl-org/SDL/issues/5227
Sam Lantinga 1a50334c 2022-01-14T15:04:26 Fixed Xbox One trigger axis zero point
Sam Lantinga 16f5b9e3 2022-01-05T11:07:52 Filter jitter on Xbox One controllers when using raw input reports
Sam Lantinga 120c76c8 2022-01-03T09:40:00 Updated copyright for 2022
Sylvain cb9f85e8 2021-11-22T11:18:01 Don't use "round", so that it's doesn't show up while searching for the function
Sylvain d31251b0 2021-11-21T22:30:48 use SDL's functions version inplace of libc version
Sam Lantinga 66058bbb 2021-11-15T16:52:56 Fixed exception accessing Bluetooth devices on Android 12 Since accessing Bluetooth prompts the user for permission on both Android and iOS, and we only need it for Steam Controller support, we'll leave it off by default. You can enable it by setting the hint SDL_HINT_JOYSTICK_HIDAPI_STEAM to "1" before calling SDL_Init() Fixes https://github.com/libsdl-org/SDL/issues/4952
Ozkan Sezer a2c27d39 2021-11-13T17:56:28 SDL_hidapi_switch.c (ConstructSubcommand): lose use of '&' on rumbleData SwitchCommonOutputPacket_t->rumbleData is an array.
Ozkan Sezer 6ad0fb84 2021-11-13T17:55:10 SDL_hidapi_ps4.c, SDL_hidapi_ps5.c: use SDL_zeroa()
Ozkan Sezer a948ff84 2021-11-13T11:50:02 SDL_hidapijoystick.c: worked around a bogus 'unreachable code' warning.
Cameron Gutman afccabb8 2021-11-11T12:12:05 joystick: Add capability flags for rumble and trigger rumble When API limitations force us to guess, we favor a false positive (reporting support when it doesn't exist) compared to a false negative.
Cameron Gutman 1ccfbf96 2021-11-11T11:13:08 joystick: Convert HasLED() into a generic GetCapabilities() function
Sam Lantinga b9b0df40 2021-11-11T12:52:31 Fixed Linux build
Sam Lantinga c9ada1c1 2021-11-11T12:45:38 Made HIDAPI device change notifications available via SDL_hid_device_change_count()
Sam Lantinga 2a6feb50 2021-11-08T07:10:38 Removed accidental debugging commit (thanks @DomGries!)
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 fe2fe290 2021-11-07T11:48:16 Backed out accidentally committed PR https://github.com/libsdl-org/SDL/pull/4849
Sam Lantinga 86bc65a7 2021-11-07T11:35:12 Fixed non-Apple builds
Sam Lantinga c501d159 2021-10-03T14:10:21 Fixed range for Steam Controller sensor values
Sam Lantinga ea1a2b94 2021-10-02T09:12:57 Use the correct update rate for Steam Controller sensors
Sam Lantinga 8b745752 2021-10-01T21:32:21 Added support for the gyro and accelerometer on Steam Controllers Fixes https://github.com/libsdl-org/SDL/issues/4577
Sam Lantinga 345c161f 2021-09-22T09:06:45 Fixed some accidental uses of external C runtime functions
Sam Lantinga 7ed7644a 2021-09-07T17:37:47 Fixed compiling HIDAPI Steam Controller support with C89 compiler
Sam Lantinga 503ea8e8 2021-08-25T14:41:58 Don't modify the Nintendo Switch home LED state by default
Sam Lantinga 907943a2 2021-08-12T17:51:08 Added support for the Xbox One S Controller with 5.x series firmware
Ozkan Sezer 7aec0b90 2021-08-13T01:56:56 SDL_hidapi_xboxone.c: fix bogus 'uninitialized' warning from clang. The last 'size == 50' check is always true anyway.
Sam Lantinga cec5a129 2021-08-12T15:49:33 Fixed libudev hotplug notifications in the HIDAPI driver
Sam Lantinga 6eb4ebb5 2021-08-12T15:49:33 Simplified the HIDAPI Xbox One controller initialization
Sam Lantinga 584b89ab 2021-08-12T08:17:10 Added support for the color LED on the Xbox Elite Series 2 controller
Sam Lantinga 64882b24 2021-08-12T08:17:08 Added support for the Xbox One Elite 2 Controller with 5.x series firmware
Ryan C. Gordon dd683073 2021-08-06T15:13:14 hidapi: Patched to compile on QNX. Fixes #4591.
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 6af6950d 2021-07-30T18:23:42 Added support for the Victrix Gambit Tournament Controller
Sam Lantinga b3a0174b 2021-07-29T14:23:15 Scale the values correctly based on the sensor type (thanks @meyraud705)
Sam Lantinga a186a503 2021-07-29T06:43:39 Added SDL_GameControllerGetSensorDataRate() to get the sensor update rate for a controller.
Sam Lantinga 2a53f831 2021-07-26T23:29:20 Fixed controllers showing up under both MFI and HIDAPI drivers The Game Controller Kit doesn't show the controllers at startup, so the HIDAPI driver sees them first and therefore gets preference when a controller is supported by both drivers. This fixes bug https://github.com/libsdl-org/SDL/issues/4209
Sam Lantinga 8d527def 2021-07-26T10:18:18 Revert "hidapi_switch: Implement HD rumble effect (#4538)" This reverts commit 19082b115b8ba3fff93e1c317c380718086a509c, which broke rumble on the Nintendo Switch Pro controller
Narr the Reg 19082b11 2021-07-26T12:00:53 hidapi_switch: Implement HD rumble effect (#4538)
Sam Lantinga 3c9559f7 2021-07-24T19:43:56 Don't try to rumble third-party Nintendo Switch Pro controllers Sending rumble to the PowerA Spectra Nintendo Switch controller hangs input reports for a couple of seconds.
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
german77 e6e8fe6d 2021-07-23T10:45:03 hidapi_switch: Implement analog rumble
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 4a20dd3e 2021-07-08T07:38:18 Removed unnecessary comment, the mic button is in byte 16 on all firmware versions
Sam Lantinga 430bbcb8 2021-07-07T09:49:33 Added HIDAPI support for the Amazon Luna Controller connected over USB in DirectInput mode
Sam Lantinga 863f5669 2021-07-07T08:55:16 Fixed reading thumbstick axes and mic button on the Amazon Luna Controller firmware version 305164320
Dimitriy Ryazantcev 17ed8d80 2021-07-07T16:05:35 Added HIDAPI backend for Amazon Luna Controller Model T28B69 connected via Bluetooth LE (VID:0171, PID:0419). To enter Bluetooth pairing mode hold B and Action (button with circle) buttons for 3 seconds. It works via usual HIDAPI if special filter driver is not installed: https://www.amazon.com/gp/help/customer/display.html?nodeId=GZCT4CTFHXLHEB9T With that driver installed it mimics Xbox One controller and works via XInput under Windows. Under DInput this controller is not usable at all.
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
Dimitriy Ryazantcev b81969d4 2021-05-17T14:50:33 Be more explicit about Xbox 360/One device ids. When Xbox One/Series Controllers are connected via USB on Windows they all are using `XBOXGIP` driver and produce a special ProductID `0x02FF` (GIP software PID) for any connected controller. On the other hand `Xbox 360 Wireless Controller Reciever` (PID 0x0719) is using `XUSB` driver and produces special ProductID `0x02A1` (XUSB software PID) for each connected Xbox 360 Wireless Controller. Also fixed Xbox One Series X Controller comment.
Sam Lantinga 3fcaf5b4 2021-05-25T10:33:30 Fixed incorrect axis scaling for Nintendo Switch controllers
Sam Lantinga 333c8e75 2021-05-17T11:54:05 The PS5 driver supports Joystick LED
Steven Noonan 4535d654 2021-04-22T14:35:59 HIDAPI_UpdateDiscovery: only treat "add" and "remove" events as relevant I have a buggy system which reports a udev "change" event for an empty USB-C port every 0.14 seconds, which causes annoying frame hitches because SDL decides that means it needs to do a libusb hid_enumerate, which is slow (~25ms!) because of the get_usb_string() calls in there. We only need to re-enumerate if we've seen a device added or removed, so let's filter out the change event first. Signed-off-by: Steven Noonan <steven@valvesoftware.com> Signed-off-by: Sam Lantinga <slouken@libsdl.org>
JibbSmart c287087f 2021-02-23T09:26:03 Only change joystick->nbuttons for Joy-Cons, since they're the only ones that have these "paddles"
JibbSmart ee52624f 2021-02-22T17:23:13 Switch Joy-Con SL and SR buttons are now mapped to matching paddle positions so that all buttons can be accessed when using SDL_HINT_JOYSTICK_HIDAPI_JOY_CONS
Mathieu Eyraud 7a2b6f33 2021-02-22T13:32:42 Guard Inotify stuff with macro This fix implicit declaration of close and unused variable warning.
David Gow db58166e 2021-02-21T17:28:08 joystick: hidapi: Properly include <unistd.h> when inotify not available In the extremely unlikely event that inotify is not available (and, therefore, HAVE_INOTIFY is not #defined), SDL will no-longer build. This is because <unistd.h> is only included when HAVE_INOTIFY is defined, and PR #4098 adds a call to access(…, F_OK), which requires <unistd.h>. (Note that the F_OK symbol is the only one which actually prevented SDL from compiling, but both access() and close() fell back to implicit definitions, which is a bit concerning.) Fixes: 8d43f45a7b ("Don't use udev for joystick enumeration if running in a container")
Ludovico de Nittis 8d43f45a 2021-02-16T14:13:30 Don't use udev for joystick enumeration if running in a container If we are running in a container, like Flatpak[1] or pressure-vessel[2], it's likely that we are using user namespaces, therefore udev event notification via netlink won't work reliably. Use their filesystem API to detect them and automatically fallback to the inotify-based enumeration. [1] <https://flatpak.org/> [2] <https://gitlab.steamos.cloud/steamrt/steam-runtime-tools/-/tree/master/pressure-vessel> Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
Ludovico de Nittis 2c326915 2021-02-16T12:39:48 Use inotify for HIDAPI joystick enumeration if not using udev This improves SDL's ability to detect HIDAPI joystick hotplug in a container environment because we cannot reliably receive events from udev in a container. For a more detailed explanation of why this issue happens with containers, please check the previous commit "joystick: Use inotify to detect joystick unplug if not using udev" (b0eba1c5). Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
Ludovico de Nittis b17242bf 2021-02-16T11:50:20 Allow libudev for HIDAPI joystick to be disabled at runtime As already explained in the previous commit "joystick: Allow libudev to be disabled at runtime" (13e7d1a9), libudev can fail in a container. To make it easier to experiment with, we add a new environment variable "SDL_HIDAPI_JOYSTICK_DISABLE_UDEV" that disables udev and let it fallback to the device enumeration using polling. Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
Sam Lantinga 42607909 2021-02-20T22:51:57 Remove devices from the list after they've been disconnected due to read errors. This fixes problems with controllers not being re-detected when a computer goes to sleep and a controller is removed and plugged back in while it's asleep.
Sam Lantinga 5427f486 2021-02-11T17:28:07 Added support for trigger rumble for all Microsoft Xbox One controllers
Ozkan Sezer dc45a228 2021-02-08T00:20:56 avoid some pedantic warnings in array initializers
Sam Lantinga 9c3aa7f0 2021-02-06T15:43:17 SDL: fix packet handling for original version of Stadia FW
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 2cc70ca3 2021-01-29T13:04:01 Fixed crash if the GameCube controller hasn't been opened yet
Sam Lantinga 7f710e93 2021-01-28T14:54:01 Make sure we don't create a game controller mapping for HID devices that aren't supported by HIDAPI
Sam Lantinga d81eaf8d 2021-01-27T12:43:35 Added explicit case from Uint8 to int before subtracting offset
Sam Lantinga bec9d740 2021-01-27T12:41:58 Fixed compile warning
Sam Lantinga ac72a2ba 2021-01-25T20:38:50 Fixed bug 5493 - Hint to let the user opt out of having Switch controllers' Home button lit when opened jibb New hint to let the user opt out of having Switch controllers' Home button lit when opened. This is more consistent with the Switch itself (which doesn't light the button normally) and may be preferred by users who may disconnect their controller without letting the application close it. I think this warrants a Switch-specific hint because the default behaviour is unusual (inconsistent with using a Switch controller on a Switch itself or with some other programs on PC), and because of that it's distinct from other lights (the player number on Switch controllers and the player colour on PlayStation controllers).
Sam Lantinga c857b5e0 2021-01-23T11:21:01 Minor cleanup
Sam Lantinga 1981d23f 2021-01-23T11:06:35 Fixed bug 5466 - Add haptic support for Stadia Controller Dimitriy Ryazantcev Consider adding support for Stadia Controller haptics. Here is example code how to deal with it: https://github.com/chromium/chromium/blob/99314be8152e688bafbbf9a615536bdbb289ea87/device/gamepad/hid_haptic_gamepad.cc#L45
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.
Sam Lantinga f68b36df 2021-01-22T11:42:42 Added support for the EVORETRO GameCube Adapter in PC mode
Sam Lantinga 9e45372a 2021-01-21T22:47:37 Fixed build on Android and iOS
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