odd problem SDL_GameControllerAddMappingsFromFile on Linux

I noticed the controller wasn’t working on my Linux build and spent some time researching the problem. Looks like I need to read in the gamecontrollerdb.txt file for the controller mappings. This seems to be automatic in Windows. Could it be because I have Steam installed? The Linux I’m running on is my own home brew Linux build so I don’t know if that’s a problem or not. I’m using the xfce4 desktop.

Well, as you can imagine, calling SDL_GameControllerAddMappingsFromFile(“gamecontrollerdb.txt”); did solve the problem. I call this right before I start checking for installed controllers on start up. At first, I didn’t think this was working but yet I pass the SDL_IsGameController() check. What I discovered by accident is if I minimize the game window and bring it back up, the controller is now working as expected and I can see the message output that I’m printing to the terminal window. Odd.

My Linux system is a “Linux From Scratch” build. I recently rebuilt my LFS build on a different computer. Oddly enough, the controller works correctly on start up. I didn’t have to minimize the window and bring it back up for it to work. The difference is a single core AMD Athlon and old AMD video card vs a faster duel core Athlon and GeForce card.