SDL/src/joystick
Sam Lantinga 345b4d7e14 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.
2020-05-29 13:37:21 -07:00
..
android Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification 2020-05-29 13:37:21 -07:00
bsd Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification 2020-05-29 13:37:21 -07:00
darwin Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification 2020-05-29 13:37:21 -07:00
dummy Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification 2020-05-29 13:37:21 -07:00
emscripten Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification 2020-05-29 13:37:21 -07:00
haiku Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification 2020-05-29 13:37:21 -07:00
hidapi Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification 2020-05-29 13:37:21 -07:00
iphoneos Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification 2020-05-29 13:37:21 -07:00
linux Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification 2020-05-29 13:37:21 -07:00
psp Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
steam Updated copyright date for 2020 2020-01-16 20:49:25 -08:00
virtual Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification 2020-05-29 13:37:21 -07:00
windows Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification 2020-05-29 13:37:21 -07:00
check_8bitdo.sh Fixed running on older versions of iOS 2020-04-27 13:31:10 -07:00
controller_type.h ControllerList: add PDP Faceoff Deluxe Audio Switch Controller and HORI Real Arcade Pro V Switch Edition 2020-05-06 11:19:52 -07:00
SDL_gamecontroller.c Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification 2020-05-29 13:37:21 -07:00
SDL_gamecontrollerdb.h Added support for the HORI Real Arcade Pro on Mac OSX and Linux 2020-05-06 12:19:58 -07:00
SDL_joystick.c Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification 2020-05-29 13:37:21 -07:00
SDL_joystick_c.h Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification 2020-05-29 13:37:21 -07:00
SDL_sysjoystick.h Fixed bug 5161 - Autodetect controller mappings based on the Linux Gamepad Specification 2020-05-29 13:37:21 -07:00
sort_controllers.py Added support for SDL hints in the game controller mapping database 2020-03-12 19:47:28 -07:00
usb_ids.h Added support for the Razer Atrox Arcade Stick 2020-04-17 21:30:58 -07:00