Skip to content

Commit

Permalink
Added support for /dev/input/js* on Linux
Browse files Browse the repository at this point in the history
Added the hint SDL_HINT_LINUX_JOYSTICK_CLASSIC to control whether /dev/input/js* or /dev/input/event* are used as joystick devices

Added the hint SDL_HINT_JOYSTICK_DEVICE to allow the user to specify devices t
hat will be opened in addition to the normal joystick detection

Fixes #1314
Fixes #1727
Fixes #1981
Closes #4727
  • Loading branch information
slouken committed Nov 11, 2021
1 parent 65a50b2 commit 1c78b08
Show file tree
Hide file tree
Showing 4 changed files with 213 additions and 60 deletions.
4 changes: 4 additions & 0 deletions WhatsNew.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ This is a list of major changes in SDL's version history.
2.0.18:
---------------------------------------------------------------------------

Linux:
* Added the hint SDL_HINT_LINUX_JOYSTICK_CLASSIC to control whether /dev/input/js* or /dev/input/event* are used as joystick devices

This comment has been minimized.

Copy link
@rofl0r

rofl0r Nov 11, 2021

Contributor

can we turn this on unconditionally if the udev device search returns zero joysticks ?

This comment has been minimized.

Copy link
@slouken

slouken Nov 11, 2021

Author Collaborator

No, because it may be that there are zero joysticks connected, and someone will hotplug a supported controller.

* Added the hint SDL_HINT_JOYSTICK_DEVICE to allow the user to specify devices that will be opened in addition to the normal joystick detection

Android:
* Added support for audio output and capture using AAudio on Android 8.1 and newer

Expand Down
18 changes: 18 additions & 0 deletions include/SDL_hints.h
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,24 @@ extern "C" {
*/
#define SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER "SDL_KMSDRM_REQUIRE_DRM_MASTER"

/**
* \brief A comma separated list of devices to open as joysticks
*
* This variable is currently only used by the Linux joystick driver.
*/
#define SDL_HINT_JOYSTICK_DEVICE "SDL_JOYSTICK_DEVICE"

/**
* \brief A variable controlling whether to use the classic /dev/input/js* joystick interface or the newer /dev/input/event* joystick interface on Linux
*
* This variable can be set to the following values:
* "0" - Use /dev/input/event*
* "1" - Use /dev/input/js*
*
* By default the /dev/input/event* interfaces are used
*/
#define SDL_HINT_LINUX_JOYSTICK_CLASSIC "SDL_LINUX_JOYSTICK_CLASSIC"

/**
* \brief A variable controlling whether joysticks on Linux adhere to their HID-defined deadzones or return unfiltered values.
*
Expand Down
Loading

0 comments on commit 1c78b08

Please sign in to comment.