SDL2 Gamepad bug?

I’ve been looking at the gamepad implementation, trying to get it to be recognised by various emulators.

I’m running the custom QMK Firmware

In ~/.profile I’ve added

export SDL_GAMECONTROLLERCONFIG="0300de1fedfe00000000000011010000,Clockwork uConsole Keyboard,platform:Linux,a:b1,b:b2,x:b0,y:b3,back:b8,start:b9,leftx:a0,lefty:a1,"

And testing with https://github.com/Grumbel/sdl-jstest confirms that it’s recognised.

When testing with ./build/sdl2-jstest -t 0 initially both dpad axis are at 0, but if you press one of the dpad buttons, on releasing it’s set at -1.

I think this may be a bug that I’ve noticed in games, where as an example:

Hold left, press right, release right. I would expect on releasing right for it go back to the left held value, but it rests at -1, which registers as no press.

I’m wondering how to go about fixing this. Would it be the QMK firmware where the behaviour of the dpad is defined or somewhere else?

After a bit more investigation, this was a red herring.

My root issue was the key priority when more than one key pressed and not returning to the state of the first key press after second key press released.

The current behaviour would be correct if the uConsole had a traditional gamepad, but as it’s separate keys the handling needs to be different.

Anyway I’ve now submitted a PR to j1n6/qmk-uconsole that resolves the key priority issue.

1 Like