Added support for /dev/input/js* on Linux

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 https://github.com/libsdl-org/SDL/issues/1314
Fixes https://github.com/libsdl-org/SDL/issues/1727
Fixes https://github.com/libsdl-org/SDL/issues/1981
Closes https://github.com/libsdl-org/SDL/pull/4727
This commit is contained in:
Sam Lantinga 2021-11-10 20:02:25 -08:00
parent 65a50b2430
commit 1c78b08007
4 changed files with 213 additions and 60 deletions

View file

@ -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.
*