# SDL2 Gamepad bug?

**URL:** <https://forum.clockworkpi.com/t/sdl2-gamepad-bug/22575>\
**Category:** uConsole\
**Tags:** tinkering, qmk\
**Created:** [June 5, 2026, 8:33am UTC](https://forum.clockworkpi.com/t/sdl2-gamepad-bug/22575 "2026-06-05T08:33:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![exhale1322](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/exhale1322/32/18056_2.png) [@exhale1322](https://forum.clockworkpi.com/u/exhale1322)\
**Post date:** [June 5, 2026, 8:33am UTC](https://forum.clockworkpi.com/t/sdl2-gamepad-bug/22575/1 "2026-06-05T08:33:04Z")

</div>

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](https://github.com/j1n6/qmk-uconsole)

In `~/.profile` I’ve added

```auto
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](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?

---

<div class="post-metadata">

**Author:** ![exhale1322](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/exhale1322/32/18056_2.png) [@exhale1322](https://forum.clockworkpi.com/u/exhale1322)\
**Post date:** [June 5, 2026, 9:59am UTC](https://forum.clockworkpi.com/t/sdl2-gamepad-bug/22575/2 "2026-06-05T09:59:25Z")

</div>

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](https://github.com/j1n6/qmk-uconsole/pull/21) to `j1n6/qmk-uconsole` that resolves the key priority issue.
