Skip to content

[WIP] universal gamepad support - #1861

Open
p3r7 wants to merge 18 commits into
monome:mainfrom
p3r7:gamepad-support-universal
Open

[WIP] universal gamepad support#1861
p3r7 wants to merge 18 commits into
monome:mainfrom
p3r7:gamepad-support-universal

Conversation

@p3r7

@p3r7 p3r7 commented Sep 21, 2025

Copy link
Copy Markdown
Contributor

this PR provides (almost) universal gamepad support

in its current state, it works pretty well on my norns with the 3 controllers I have tested with.

how?

this PR removes the use of custom gamepad profiles as lua files and instead relies on the SDL controller profile database.

i didn't use those profiles in the first place as they were lacking the info of analog sensors resolution (EV_ABS, ABS for absolute),

but i discovered that those resolutions could be retrieved with a call to libevdev_get_abs_info.

by combining the 2, we're 100% compatible with our old custom profile logic.

i didn't know this was possible, as SDL itself seems to not look up this info and hard-codes resolution in its code source for a selected number of controllers. e.g.:

image

i guess they do that do be as platform-agnostic as possible...

what's next to do

everything works fine but i'm getting this error message in the matron logs when i plug a controller. everything seems to work though. idk if it was occurring before my patch or not but i may be doing something wrong.

   dev_monitor: skipping node-less entry in /dev/input
   failed to init libevdev (Invalid argument)
   dev_list_add: error allocating device data

also i just dropped the SDL gamepad db file under lua/core/gamecontrollerdb.txt. but it may be smarter to grab it as a git submodule. what do you think about it?

also i'd certainly merge the gamepad_db.lua and gamepad.lua files into one.

@Dewb

Dewb commented Sep 23, 2025

Copy link
Copy Markdown
Member

What is the test procedure to verify that a controller works as expected with the new arrangement? My collection of older stuff is unfortunately in storage at the moment but I have some 8bitdo and Microsoft units handy.

@p3r7

p3r7 commented Oct 10, 2025

Copy link
Copy Markdown
Contributor Author

progressed a bit more on this. there are still some optims & simplifications here & there i'd like to make. i also realized that the gamepad.dpad callback doesn't fire properly so i should fix that as well.

but i'm getting close to having something mergeable.


What is the test procedure to verify that a controller works as expected with the new arrangement?

i just made a script for that: gamepad-monitor.

image

otherwise navigating in the global menu is another way to test (though not as extensive).

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