Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Solved] XBox controller not working correctly on Raspbian with latest source build. (actually under Retropie) #4655

Closed
Fredrum opened this issue Aug 15, 2021 · 6 comments

Comments

@Fredrum
Copy link

Fredrum commented Aug 15, 2021

I'm working on a gaming application and am noticing that mine and others' XBox controllers are not working as expected.

Some button mappings are good but others are incorrect or absent.

I'm on Raspbian Buster 32bit with Kernel 5.10.
Raspberry Pi4B

I apt removed the previous copy of SDL2.
I then git cloned the main master of this SDL git repo and successfully built. (so should have gotten the latest as of yesterday)

I just now also built the SDL test programs and ran 'testgamecontroller' which confirmed that SDL is not handling it correctly.

This should be my controller:
Joystick Name: 'Microsoft X-Box One pad (Firmware 2015)'
Joystick GUID: 030000005e040000dd02000003020000
Joystick Number: 0
Number of Axes: 4
Number of Buttons: 13
Number of Hats: 1
Number of Balls: 0
GameController:
Name: 'XInput Controller'
Mapping: '(null)'

I have had other users (of the app I'm working on) that also report xbox controllers not working.

Is there a known workaround to this?

Cheers
Fred

@Fredrum
Copy link
Author

Fredrum commented Aug 17, 2021

Ok so I managed to get my XBox One controller to work with test/testgamecontroller but only by editing the testgamecontroller.c source adding a call to SDL_GameControllerAddMappingsFromFile() which I pointed to a small file generated by test/controllermap.

Is this expected behavior as my DS4 controllers don't need this?

Is there a rule for when this is needed and when it is not?

Is it because the xbox controllers are XInput devices?

@Fredrum
Copy link
Author

Fredrum commented Aug 18, 2021

Update:

I proceeded with trying to use the well known controller remapping file https://github.com/gabomdq/SDL_GameControllerDB/blob/master/gamecontrollerdb.txt

instead of my homebaked version so I could cover the very large set of controllers included in that file.

But I found that the remappings in the gamecontrollerdb.txt file did not work. The one I generated with test/controllermap does make my xbox controller work.

So this was a setback that I'm now not sure how to resolve.
I did check the db file for the guid I was using and it had an entry under 'Linux' (as I'm on Raspbian, a Debian derivative) but the mappings were different from the ones I had generated myself.

Does anyone know why this is?

@Fredrum
Copy link
Author

Fredrum commented Aug 19, 2021

Update, comparing remap files just generated with test/controllermap with the corresponding entries in https://github.com/gabomdq/SDL_GameControllerDB/blob/master/gamecontrollerdb.txt shows completely different mapping entries.

So far for my XBox One pad and another users XBox 360 gamepad.

I feel something has changed but I don't know where.

@Fredrum
Copy link
Author

Fredrum commented Aug 19, 2021

Connected to:

mdqinc/SDL_GameControllerDB#478

?

@Fredrum
Copy link
Author

Fredrum commented Aug 21, 2021

I just re-flashed a microsd card with a 10 month old Raspbian OS image (official) and installed my software on that.
My Xbox One controller is working perfectly on that setup. So something has changed since then. I'm still looking for the precise change though so this can actually be fixed.

These are some of the versions,

Setting up libsdl2-dev (2.0.9+dfsg1-1+rpt1) ...

-- Checking for module 'libudev'
-- Found libudev, version 241

Kernel 5.4.51-v7l+

Elsewhere Iv'e noticed messages about the kernel driver 'xpad'. Not exactly for my symptoms though so not sure if that would be involved.

@Fredrum Fredrum changed the title XBox controller not working correctly on Raspbian with latest source build. XBox controller not working correctly on Raspbian with latest source build. (actually under Retropie) Aug 22, 2021
@Fredrum
Copy link
Author

Fredrum commented Aug 22, 2021

Problem Solved!
The issue was that I was running in a Retropie raspbian OS image and they have added a custom 'xpad' driver which is active by default.
Once I removed the custom one and let the system fall back on the default xpad driver it all started working fine again! :)

You can read more here: RetroPie/RetroPie-Setup#3379

@Fredrum Fredrum closed this as completed Aug 22, 2021
@Fredrum Fredrum changed the title XBox controller not working correctly on Raspbian with latest source build. (actually under Retropie) [Solved] XBox controller not working correctly on Raspbian with latest source build. (actually under Retropie) Aug 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant