Skip to content

Conversation

@Lawstorant
Copy link
Contributor

@Lawstorant Lawstorant commented Jan 4, 2026

Description

Adds support for new EV_BTN event that'll be used in place of EV_KEY for joysticks and maybe gamepads. This event doesn't require any mapping as it simply passes through button number as the code (starting from 1 just like HID) and it's value.

It was needed to cleanly support joysticks and simracing/simflight hardware that defines more than 80 buttons. Some HW used hacks in the drivers that assigned random usages found lower then TRIGGER_HAPPPY range.

WIP work dependent on upstream patches to LKML: https://lore.kernel.org/all/[email protected]/

All 128 buttons visible in Wine without usage hacks (SDL bus):

Screenshot From 2026-01-04 16-44-58

@Lawstorant Lawstorant changed the title Add support for new EV_BTN event in evdev Add support for new EV_BTN event in linux joystick Jan 4, 2026
@slouken
Copy link
Collaborator

slouken commented Jan 4, 2026

It looks like this has the potential to change gamepad mappings. Are you sure that game controllers will have the buttons in the same order between new and old kernels?

@Lawstorant
Copy link
Contributor Author

This only applies to Joysticks as of now. As far as order of buttons is concerned, it should be the same if drivers don't change it. Still, gamepads are kept on EV_KEY and things will still change depending on the lkml discussion

Adds support for new EV_BTN event that'll be used in place of EV_KEY for
joysticks and maybe gamepads. This event doesn't require any mapping as
it simply passes through button number as the code (starting from 1 just
like HID) and it's value.

It was needed to cleanly support joysticks and simracing/simflight
hardware that defines more than 80 buttons. Some HW used hacks in the
drivers that assigned random usages found lower than
TRIGGER_HAPPPY range.
@Lawstorant
Copy link
Contributor Author

@slouken I thought that maybe instead of redefining missing usages, a better way would be to make #ifndef gates that would remove the code related to this? Without EV_BTN EVIOCGBTNCNT would never fire BUT maybe defining it as a random 0 isn't the best idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants