A few days ago I bought a Logitech F310 gamepad at my local thrift store. FreeBSD detected it immediately and created the appropriate uhid entry in /dev. SDL2 also saw the gamepad, which I was able to verify with Joytran. The Mednafen game console emulator did not see the device, however. Here's why:
Mednafen 1.22.2 supports three different joystick backends: Linux event devices (evdev), SDL2, and MS Windows DirectInput / XInput devices. The backend is selected when the autoconf ./configure script is run, and then that backend selection is compiled into the Mednafen binary (see the ifdef statement at line 178 in src/drivers/Joystick.cpp).
Mednafen's autoconf script selects the evdev backend if it finds the file linux/joystick.h in the header search path. The FreeBSD port devel/evdev-proto installs that joystick.h header file. So, if you have evdev-proto installed (it's required by x11-toolkits/qt5-gui) and then compile emulators/mednafen it will use evdev and not SDL2 for its joystick support.
I worked around this by commenting out parts of src/drivers/Joystick.cpp (again around line 178) to force Mednafen to use SDL2 for joysticks. I should probably post on FreeBSD's bug tracker; could submit a patch too, it's simple enough.
This whole situation is definitely a corner case. The joystick backend selection in Mednafen could be better, but I'm also doing something a little unusual here.
Posting because this took me hours to figure out, and so I'll remember next time I encounter this problem.
If you've written a response to this post then please let me know the URL:
You can also submit a "comment" webmention by pressing the button below. It may take a day or two for your comment to appear here and a copy of your comment will be stored at commentpara.de.