-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
[input] Gamepad buttons and axis not working (linux) #1319
Comments
@muevoid is the gamepad connected before running the example? It should be at least detected... it could be a KISS Linux specific issue... |
Yes i can confirm the gamepad is connected before hand. I'm not sure exactly what on KISS could cause this issue. |
@muevoid raylib uses GLFW internally on DESKTOP_PLATFORM (Windows, Linux, macOS) to manage inputs. Every frame [core]
|
Kk I am familiar with glfw and will test this tommorow. |
Just a reference in case it can be useful in the future for gamepad buttons mapping: https://www.glfw.org/docs/3.3/input_guide.html#gamepad |
An additional perspective > I just tried this on Ubuntu 20.04 LTS x86_64, kernel: 5.4.0-42-generic, using raylib 3.0.0. My build of 'core_input_gamepad.c' detects both a cheap Logitech controller and an 8bitdo SNES controller. They do not need to be plugged in before compilation; I can disconnect and reconnect the controllers, and the program will detect them and display their names correctly. However, I can't seem to be able to get any input from any of them, and neither buttons nor axes show up in the interface. |
Hmmm I am still doing testing will post here soon. |
This is for sure an issue with my configuration and not raylib. So I will close this jist of it was my Xorg configuration and some stuff with evdev. Edit: I believe defutura's issue is unrelated to this issue. |
I may have talked too soon my issue is now identical to defuturas. Gamepad is detected by raylib however no buttons or axis is detected. |
I should have expressed myself more clearly here. My build does in fact detect the 5 axes correctly with GetGamepadAxisCount() on line 164, and displays them with the following for loop, but no input data is shown for any of them. |
@defutura Have you had any luck with this yet? |
@muevoid No, I haven't looked at it yet, I'm doing most of my programming on a Windows machine. Will post here if I find anything out. |
@defutura, @muevoid: My joystick worked fine with SDL and glfw3 sample codes, but not with raylib. I've found a mapping for my gamepad here: With the mapping configuration for my gamepad, I cloned the raylib repo and added the mapping in the file <RAYLIB_HOME>/src/external/glfw/src/mappings.h and then recompiled the whole thing again. After this it all worked. To find my gamepad ID, I added a debug printf to log js->guid at the beginning of findValidMapping (<RAYLIB_HOME>/src/external/glfw/src/input.c). Then I recompiled the gamepad example and ran, checking the console output for the Gamepad ID. Or, you could try to update the mappings dynamically |
It seems the glfw mappings.h file is outdated (it was updated 10 months ago and it has 476 lines, while the gamecontrollerdb.txt has more than 800). They have a Cmake script that "updates" the mappings.h file with the latest gamecontrollerdb.txt contents: Maybe they manually execute that cmake script as part of the build? I cloned their repository and issued the following commands to update the mappings and it worked (the final mappings file went from 476 lines to 954 and my gamepad id was finally there): cd glfw/CMake That command worked when I executed it from the raylib repo too (<RAYLIB_ROOT>/src/external/glfw/CMake). |
@coderoth I maintain the plain Makefiles building system, not the CMake... maybe I can just update |
Updated version of the file: Created the following pull request, if you prefer: |
Updated! It should work now! Closing the issue! |
Issue description
I have tried in both my own project and the gamepad example both in browser and
on my machine compiled. However it just shows up with gamepad not detected.
I have tested with jstest to make sure the joystick is showing up on a system
level and it appears to be fine. (To note i have tried this with both a Xbox
one controller and a steam controller)
Environment
I am on KISS Linux latest stable kernel.
Code Example
Just the code in the gamepad_test_example that checks if a gamepad is
available. AKA (IsGamePadAvailable(GAMEPAD_PLAYER1))
The text was updated successfully, but these errors were encountered: