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

SDL_EVDEV_do_text_input() may be too eager to find error cases #2357

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

SDL_EVDEV_do_text_input() may be too eager to find error cases #2357

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments


Copy link

@SDLBugzilla SDLBugzilla commented Feb 11, 2021

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: 2.0.5
Reported for operating system, platform: Linux, ARM

Comments on the original bug report:

On 2017-01-05 07:25:27 +0000, Rob wrote:

Created attachment 2658
artifacts for review


I've ran into an issue where I successfully receive SDL_KEY[UP,DOWN] events but not SDL_TEXTINPUT or SDL_TEXTEDITING. In my case the code in SDL_EVDEV_do_text_input() is returning early (on error) prior to calling SDL_SendKeyboardText(). I'm running on the RaspberryPi 3, without X11.

In SDL_EVDEV_do_text_input() there is a condition to check keysyms with a type value below 0xf0, then subtract 0xf0 from type. Without understanding the purpose of this code, I disabled it, recompiled, and I'm getting correct SDL_TEXTINPUT events. I'm going to guess that my hack/fix is going to be problematic in some other environment, but after some initial testing it looks like everything is running fine in my setup.

My setup is a little different than what is recommended in docs/, so its quite possible this is the source of my pain. I'm hoping someone more familiar with udev may be able to jump in and help identify if this is the case.

My setup:

  • SDL2-2.0.5 on the RaspberryPi 3, running the 4.4.34-v7+ kernel, and udev 215.
  • Cross-compiled using gcc 4.8.3.
  • I'm building SDL with support for udev, and dbus. IME, ibus, and fcitx are disabled.
  • I've disabled X11 support when building SDL. I'm using the GLES2 and VideoCore libraries.
  • In docs/ it recommends a way to modify a fully built out raspbian image. My approach is different. I'm building up my own rootfs. It's also based on raspbian packages, but only those that I explicitly want.
  • I'm not installing any X11 packages (like those suggested in docs/

I've attached a tar.gz with a number of files that may be interesting to review.

  • hack.patch - My SDL_evdev.c modifications. Seriously, this is a hack for debug/test.
  • keyboardhell.cpp - Test code to loop on keyboard events from SDL_PollEvent().
  • capture.log - keyboardhell execution on RPi after applying hack.patch. Note the following keyboard input sequence: 'l','s',,. Also of interest SDL_EVDEV_mute_keyboard() does not appear to mute tty.
  • - Script used to ./configure SDL build.
  • sdl.log - SDL build log.
  • OTHER - all other logs were captured on the RPi.


On 2017-01-05 23:00:15 +0000, Rob wrote:

I've cleaned up my patch to illustrate only what is necessary to fix my setup.

Without realizing it I found and fixed a related bug, that I didn't mention earlier. This is related to how SDL_EVDEV_is_console() is being used. See bug # 3546 for further description.

Also, SDL_EVDEV_mute_keyboard() is broken. I but I believe I already saw a ticket for this.


On 2017-01-05 23:01:02 +0000, Rob wrote:

Created attachment 2660
reduced hack patch

On 2017-01-07 18:15:31 +0000, Sam Lantinga wrote:

tvc, can you take a look at this?

On 2017-01-09 04:03:56 +0000, Sam Lantinga wrote:

After discussion with tvc, we have a fix. Thanks!

On 2017-01-09 04:10:10 +0000, Rob wrote:

Awesome. I will update and try it out this week.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

1 participant