Getting my USB Controller / Joypad / Gamepad working under FreeBSD 13.0

BobbyDropTables

New Member


Messages: 2

Hello everyone,

I am fairly new to FreeBSD and I use it successfully as my OS of choice for the small VPS project I have.
Since I want to get away from Windows in my home in the near future, I am currently testing the viability of FreeBSD as my Desktop OS as well.
At the moment I have it on my Notebook as a proof of concept and most things just work out of the box... and the things that didn't, have been fixable rather easily.

Detailed OS info: FreeBSD 13.0-RELEASE-p4 amd64

Now I want to get 2 important things working on that Notebook:
  • an emulator for GBA
  • an emulator for Nintendo64
And I want to use my Xbox360 USB Controller to play the games.
Let's focus on the GBA part first.
I am using "mGBA 0.9.2" from the ports and compiled it with the Qt-frontend.
The SDL library used is 2.0.12 (that one is responsible for the controller handling).
But when I try to configure the controller in the settings, it seems the 4 Dpad buttons aren't recognized at all... and the Joysticks seem to be inverted along the Y axis.
(Also the controller must be plugged in when I start the app, otherwise it won't recoginze it... strange, but a topic for another fight)
All the other buttons seem to work without issue.
Now I want to investigate >where< exactly the problem occurs.
It could be in either one of those:
  • mGBA issue
  • SDL issue
  • FreeBSD driver issue

I ran usbhidctl to get info if the system detects the hardware correctly... nothing super strange... except maybe that the Dpad buttons are in a collection inside of another collection.
I know too little about it all to be certain if this is normal or not.
Code:
[root@fbsdbook /home/alphaomega]# usbhidctl -f /dev/uhid0 -rv
Report descriptor:
Collection type=Application page=Generic_Desktop usage=Game_Pad
Input   rid=0 pos=0 size=8 count=1 page=0x0000 usage=0x0000 Const Array, logical range 0..0
Input   rid=0 pos=8 size=8 count=1 page=Generic_Desktop usage=Byte_Count Const Array, logical range 0..0
Collection type=Physical page=Generic_Desktop usage=Pointer
Input   rid=0 pos=16 size=1 count=1 page=Generic_Desktop usage=D-pad_Up, logical range 0..1, physical range 0..1
Input   rid=0 pos=17 size=1 count=1 page=Generic_Desktop usage=D-pad_Down, logical range 0..1, physical range 0..1
Input   rid=0 pos=18 size=1 count=1 page=Generic_Desktop usage=D-pad_Left, logical range 0..1, physical range 0..1
Input   rid=0 pos=19 size=1 count=1 page=Generic_Desktop usage=D-pad_Right, logical range 0..1, physical range 0..1
End collection
Input   rid=0 pos=20 size=1 count=1 page=Button usage=Button_8, logical range 0..1, physical range 0..1
Input   rid=0 pos=21 size=1 count=1 page=Button usage=Button_7, logical range 0..1, physical range 0..1
Input   rid=0 pos=22 size=1 count=1 page=Button usage=Button_9, logical range 0..1, physical range 0..1
Input   rid=0 pos=23 size=1 count=1 page=Button usage=Button_10, logical range 0..1, physical range 0..1
Input   rid=0 pos=24 size=1 count=1 page=Button usage=Button_5, logical range 0..1, physical range 0..1
Input   rid=0 pos=25 size=1 count=1 page=Button usage=Button_6, logical range 0..1, physical range 0..1
Input   rid=0 pos=26 size=1 count=1 page=Button usage=Button_11, logical range 0..1, physical range 0..1
Input   rid=0 pos=27 size=1 count=1 page=0x0000 usage=0x0000 Const Array, logical range 0..1, physical range 0..1
Input   rid=0 pos=28 size=1 count=1 page=Button usage=Button_1, logical range 0..1, physical range 0..1
Input   rid=0 pos=29 size=1 count=1 page=Button usage=Button_2, logical range 0..1, physical range 0..1
Input   rid=0 pos=30 size=1 count=1 page=Button usage=Button_3, logical range 0..1, physical range 0..1
Input   rid=0 pos=31 size=1 count=1 page=Button usage=Button_4, logical range 0..1, physical range 0..1
Input   rid=0 pos=32 size=8 count=1 page=Generic_Desktop usage=Z, logical range 0..255, physical range 0..255
Input   rid=0 pos=40 size=8 count=1 page=Generic_Desktop usage=Rz, logical range 0..255, physical range 0..255
Input   rid=0 pos=48 size=16 count=1 page=Generic_Desktop usage=X, logical range -32768..32767, physical range -32768..32767
Input   rid=0 pos=64 size=16 count=1 page=Generic_Desktop usage=Y, logical range -32768..32767, physical range -32768..32767
Input   rid=0 pos=80 size=16 count=1 page=Generic_Desktop usage=Rx, logical range -32768..32767, physical range -32768..32767
Input   rid=0 pos=96 size=16 count=1 page=Generic_Desktop usage=Ry, logical range -32768..32767, physical range -32768..32767
Input   rid=0 pos=112 size=48 count=1 page=0x0000 usage=0x0000 Const Array, logical range -32768..32767, physical range -32768..32767
End collection
Total   input size 20 bytes
Total  output size 0 bytes
Total feature size 0 bytes

Is there a program I can run, which will tell me the button presses on my controller, so I can see if the issue is with the library/app I am using, or if it is an OS thing?
There is "xev" which shows me that stuff for my keyboard and mouse, but it doesn't work for the controller of course, since it is not an X input device.
Any help is much appreciated :)

Kind regards
 
OP
B

BobbyDropTables

New Member


Messages: 2

Thanks for the hint, I didn't know about controllermap.
I tried antimicro before, which at least responded to button presses, but this now also shows it on a graphic.
Unfortunately the DPad buttons still do not work - controllermap was compiled against SDL 2.0.12 btw.

For testing purposes I set up an Artix Linux VM today and installed mGBA there too (which was linked with SDL 2.0.16).
Either this is a problem with the FreeBSD driver (because Linux does work ootb), or with the SDL library.
Can I compile a port against a specific newer version of SDL? I haven't done unguided compilings (only FreeBSD ports or Arch AUR) before.
 
Top