Skip to content

Improve joystick/game pad detection

As documented in the kernel, BTN_GAMEPAD can be used to differenciate gamepads from other devices:

All gamepads that follow the protocol described here map BTN_GAMEPAD.
This is an alias for BTN_SOUTH/BTN_A. It can be used to identify a gamepad as such.

https://www.kernel.org/doc/html/latest/input/gamepad.html#detection

Joystick detection is not documented, but looking at the kernel code, BTN_JOYSTICK is the equivalent for joysticks:

hid-input.c:

switch (field->physical) {
[...]
case HID_GD_JOYSTICK: code += BTN_JOYSTICK; break;
case HID_GD_GAMEPAD:  code += BTN_GAMEPAD; break;

Add the required checks in libinput to detect joysticks and gamepads.

Fix #701 (closed)

Fix #415 (closed)

Fix #703 (closed)

Edited by José Expósito

Merge request reports