The SDL forums have moved to discourse.libsdl.org.
This is just a read-only archive of the previous forums, to keep old links working.


SDL Forum Index
SDL
Simple Directmedia Layer Forums
Why won't SDL detect my iBuffalo game controller on Linux?
andrewhavens


Joined: 30 Jun 2016
Posts: 2
I recently obtained an ARM-based Linux computer called a PocketCHIP. It's a great little computer! I'm working on writing a program which uses SDL 2.0.4 and my iBuffalo USB gamepad. However, SDL does not seem to recognize the controller on the PocketCHIP. I think this is a popular controller, so it would surprise me if SDL did not already support it, which makes me think that there's something wrong with my setup/installation. The controller does work in other programs though (mednafen).

On my Mac, when I run the testgamecontroller.c, testjoystick.c, and controllermap.c scripts that are included in the SDL test directory, they all recognize the controller correctly:

Code:

$ ./controllermap
INFO: Joystick 0: USB,2-axis 8-button gamepad   (guid 83050000000000006020000000000000)
INFO: There are 0 game controller(s) attached (1 joystick(s))


However, when I run the same scripts on the PocketCHIP, it does not detect the controller. Linux does seem to recognize the device as connected though:

Code:

$ cat /proc/bus/input/devices
...

I: Bus=0003 Vendor=0583 Product=2060 Version=0110
N: Name="USB,2-axis 8-button gamepad  "
P: Phys=usb-1c14400.usb-1/input0
S: Sysfs=/devices/platform/soc@01c00000/1c14400.usb/usb2/2-1/2-1:1.0/0003:0583:2060.0003/input/input5
U: Uniq=
H: Handlers=js0 event2
B: PROP=0
B: EV=1b
B: KEY=ff 0 0 0 0 0 0 0 0 0
B: ABS=3
B: MSC=10


What do I need to do to get SDL to recognize my controller on the PocketCHIP?
Found the solution!
andrewhavens


Joined: 30 Jun 2016
Posts: 2
I found the solution!

I learned that SDL uses
Code:
/dev/input/event*
for gamepad input capture. However, my user (chip) did not have permission to access these, so it was failing silently.

To grant the chip user access, add the chip user to the input group.

Code:
sudo nano /etc/group


Arrow down to the line that says:

Code:
input:x:101:


to:

Code:
input:x:101:chip


Save the file. Restart your PocketCHIP and SDL will now be able to read the gamepad input.