We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3803 - Raspberry Pi - No text input into the ioquake3 console
Summary: Raspberry Pi - No text input into the ioquake3 console
Status: RESOLVED INVALID
Alias: None
Product: SDL
Classification: Unclassified
Component: *don't know* (show other bugs)
Version: 2.0.5
Hardware: ARM Linux
: P2 normal
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-06 21:29 UTC by q3dev
Modified: 2017-11-30 00:25 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description q3dev 2017-09-06 21:29:59 UTC
Hello,

SDL2-2.0.4 works great and allows text input into the ioquake3 console and say command.  Both 2.0.5 and 2.0.6 don't allow any text to be entered, although key bindings to bring down the console work. The mouse and other functions in the game work fine.  After compiling dozens of versions of SDL2 I tracked the problem down.  The issue started with changeset 10433	0f79dd727ed6, Fixed bug 3157 - Rudimentary touchscreen support in SDL_evdev (supports Raspberry Pi).
http://hg.libsdl.org/SDL/rev/0f79dd727ed6
Versions of SDL2 from this point forward have the issue.  Tested on Raspbian Jessie and Stretch, desktop and lite on a Pi 3.  Also tested with the SDL2-2.0.6 prerelease. I'm available to compile and test any fixes.

Thank you.
Comment 1 Sam Lantinga 2017-09-06 22:35:10 UTC
Can you make sure SDL_INPUT_LINUXKD is defined in SDL_config.h?
Comment 2 q3dev 2017-09-06 23:08:30 UTC
Yes, it's defined on line 236:

#define SDL_INPUT_LINUXKD 1

I'm compiling with the following configure options and output:

./configure --host=arm-raspberry-linux-gnueabihf \
              --enable-alsa \
              --disable-alsa-shared \
              --disable-pulseaudio \
              --disable-esd \
              --disable-dummyaudio \
              --disable-diskaudio \
              --disable-video-dummy \
              --disable-video-opengles1 \
              --disable-video-mir \
              --disable-video-wayland \
              --disable-video-x11 \
              --disable-video-vivante \
              --disable-video-vulkan \
              --disable-video-opengl

SDL2 Configure Summary:
Building Shared Libraries
Building Static Libraries
Enabled modules : atomic audio video render events joystick haptic power filesystem threads timers file loadso cpuinfo assembly
Assembly Math   :
Audio drivers   : oss alsa
Video drivers   : rpi opengl_es2
Input drivers   : linuxev linuxkd
Using libsamplerate : YES
Using libudev       : YES
Using dbus          : YES
Using ime           : YES
Using ibus          : YES
Using fcitx         : YES
Comment 3 Ryan C. Gordon 2017-09-06 23:23:16 UTC
Possibly related comment relating to the touch screen code:

https://discourse.libsdl.org/t/last-call-for-2-0-6-bugs/22527/49

--ryan.
Comment 4 q3dev 2017-09-06 23:46:06 UTC
Bug report 3606 may also be related.

https://bugzilla.libsdl.org/show_bug.cgi?id=3606
Comment 5 Sam Lantinga 2017-09-07 15:12:46 UTC
Ryan, since you have a Pi setup working, can you take a quick look at this?

Thanks!
Comment 6 Sam Lantinga 2017-09-09 17:04:21 UTC
I just tested on Raspian Jessie with testsprite2 --info all and I'm seeing key up/down events as well as text events. The keystrokes don't leak into the console.

Can you add printf debugging to the evdev code find out what's going on?
Comment 7 q3dev 2017-09-09 23:49:36 UTC
I'm a programming novice so I'm not sure how to do that.  If someone has the code or can point me to a tutorial I'll give it a shot.  I looked online at the libevdev documentation and they appear to have a logging function, although I'm not sure how to utilize that.
https://www.freedesktop.org/software/libevdev/doc/latest/group__logging.html
I ran evtest but didn't see anything unusual; it was logging key codes while playing the game.
As for the keypress leakage, I just tested with the 2.0.6 prerelease and it leaks keypresses back to the x11 desktop.  I'm able to work around that with a wrapper script by disabling keyboard input to x11 with xinput.  I have SDL2 compiled with --disable-video-x11 if that helps.
Comment 8 Sam Lantinga 2017-09-10 00:13:46 UTC
Ryan, are you able to reproduce this?
Comment 9 Ryan C. Gordon 2017-09-10 01:07:52 UTC
(In reply to Sam Lantinga from comment #8)
> Ryan, are you able to reproduce this?

Gonna take a look at this shortly.

--ryan.
Comment 10 q3dev 2017-09-11 21:10:46 UTC
I did some additional testing and discovered that ioquake3 has a built-in feature to print keyboard debug info.  It’s turned on with “set in_keyboardDebug 1”.  It prints the correct key codes even though the key presses don’t show up in the console or with the say command.
Comment 11 Sam Lantinga 2017-09-12 23:34:37 UTC
In bug 3606 they noted this issue was resolved with the latest SDL 2.0.6 build, but they had to remove the SDL2 packages to get it to work. Is that what's happening here, that you're picking up an old SDL installation somewhere else on the system?
Comment 12 q3dev 2017-09-13 02:04:02 UTC
I’m using a fresh install of Raspbian Stretch, and I haven’t installed SDL2 from the repositories.  Just to be sure I entered “sudo apt-get remove libsdl2-dev” and it reported that it’s not installed.  I’ve only been compiling and installing from source. I searched the entire SD card for other copies of the SDL2 libraries and only found them in /usr/loca/lib and the various source code directories. I also searched for old copies of SDL.h and SDL_version.h as mentioned in bug 3606 and didn’t find any except for the current ones in /usr/local/include/SDL2.

I deleted the SDL2 libraries from /usr/local/lib, then compiled the latest SDL2-2.0.6-11489 and it still has the issue of not allowing text to be typed into the console or say command.  I then switched to my SDL2-2.0.4 source directory and installed that version and everything works again.  Versions of SDL2 starting with changeset 10433 0f79dd727ed6 don’t seem to work for some reason.  Are there other tests I can run?

Thanks.
Comment 13 Sam Lantinga 2017-09-13 03:52:17 UTC
Yes, you can edit src/core/linux/SDL_evdev_kbd.c and add a printf statement next to SDL_SendKeyboardText() to make sure it's getting called.
Comment 14 Sam Lantinga 2017-09-13 03:54:46 UTC
Also, just as a sanity check you can add print statements to SDL_StartTextInput() and SDL_StopTextInput() to see when they're getting called.
Comment 15 Ryan C. Gordon 2017-09-13 17:16:51 UTC
What branch of ioquake3 are you building? Is it the one from https://github.com/raspberrypi/quake3.git ?

--ryan.
Comment 16 q3dev 2017-09-14 02:51:08 UTC
@Sam
I added a printf statement to SDL_SendKeyboardText, SDL_StartTextInput, and SDL_StopTextInput and they're each getting called.  SDL_StartTextInput is called twice as the player enters the game.
SDL_SendKeyboardText is called quite a number of times during the game, and SDL_StopTextInput is called last as the game exits.  It's still not showing any text typed into the console.

@Ryan
I'm using the latest ioquake3 codebase from Github with an added OpenGL ES renderer.  It's an update of an older port.
Comment 17 Ryan C. Gordon 2017-09-14 12:24:12 UTC
(In reply to q3dev from comment #16)
> @Ryan
> I'm using the latest ioquake3 codebase from Github with an added OpenGL ES
> renderer.  It's an update of an older port.

Is the source available somewhere? I'm trying to build something equivalent here for testing.

--ryan.
Comment 18 Sam Lantinga 2017-09-14 14:56:31 UTC
This is sounding like a bug in ioquake3 if text is getting sent to the application. Is it handling the SDL_TEXTINPUT event?

Can you add a print statement inside SDL_SendKeyboardText() to make sure SDL_TEXTINPUT is enabled and the event is actually getting sent?
Comment 19 Ryan C. Gordon 2017-09-14 18:35:41 UTC
ioquake3 does explicitly handle SDL_TEXTINPUT events, fwiw. I'd feel better about this bug if there wasn't a definite SDL revision, that deals with RPi input, before which it worked.

I need to build the same thing q3dev is looking at, though, to be more useful here. Upstream ioquake3 doesn't have a GLES renderer at the moment, so I can't just plunk this onto a Pi to reproduce.

--ryan.
Comment 20 q3dev 2017-09-14 21:44:40 UTC
@Sam
I added a printf statement to src/core/linux/SDL_evdev_kbd.c as you mentioned, here's the snippet:

    if (kbd->text_len > 0) {
        kbd->text[kbd->text_len] = '\0';
        SDL_SendKeyboardText(kbd->text);
        printf(" SDL_SendKeyboardText-called ");
        kbd->text_len = 0;
    }

SDL_SendKeyboardText gets called many times during the game.

I also previously added a printf statement to SDL_SendKeyboardText () in /src/events/SDL_keyboard.c, which produced the behavior that I described above. During that testing I commented-out the the printf statement in SDL_evdev_kbd.c.  Sorry for any confusion there.

@Ryan
I sent you an email about obtaining the source code.
Comment 21 q3dev 2017-11-29 21:33:56 UTC
The issue ended up being caused by an old OpenGL ES renderer that I was using.
Comment 22 Sam Lantinga 2017-11-30 00:25:18 UTC
Good to know, thanks!