Sorry if this is the wrong place to post it, but I would like to have it here for future references. I wrote the same reddit post this is taken from.
A few days ago I was struggling to get the Stadia controller working correctly with my Fedora computer.
I found a very nice post mainly focused on Ubuntu and derivatives. It was an excellent piece, but unfortunately outdated given its dependency on the xboxdrv.
Going a little bit deeper, I found out most of the inputs in Linux are handled by the SDL library, which is shipped, of course, with Fedora. The issue comes from an incorrect mapping in SDL in the first place, so we must correct that mapping for the controller to work properly.
So that’s what I did with the help of AntimicroX (in the official Fedora repos as well as a fantastic Flatpak that’ll work virtually everywhere).
- I followed this wonderful guide from the devs to set the mappings just as I wanted.
- I set the environmental variable
SDL_GAMECONTROLLERCONFIGto the values I got from (1). You can do this in 2 ways:
(Either) Every single time you are going to use that controller, open the terminal window and type
export SDL_GAMECONTROLLERCONFIG="<string>". Then, on that same terminal session, execute whatever software/game you wanted to play with the gamepad.
(Or) Go to
$HOME/.profile(you can replace
~) and write at the end of then file
.profile. To be honest, the
.profileone didn’t work for me, but IDK if I did something wrong here.
After that, your controller will work fantastically. I have to say I’m extremely impressed by the level of flexibility of the input systems in Linux. You can tweak basically any controller to work with it, even the ones that are incorrectly mapped can be remapped. This can be useful for anyone else using weird, strange controllers or gamepads that may have some faulty buttons and you may want to still use (at the end of the day, some gamepads have more buttons that some emulators/games require).
That’s the power of Linux, my friends!
Thanks to the great guys of AntimicroX, Fedora and RedHat teams, as well as this random guy who gave me a lot of insight .
Bonus: This is the mapping I got done:
With the full export key being: