Raspberry Pi: Can't grab keyboard input |
accumulator
|
Hi all,
I can't seem to get keyboard events with SDL2 + Raspberry Pi. I've tried running in the console as well as in X. I'm in the input/tty group. All input seems to go through to X or the console and a mouse cursor shows up (in console or X) in the top left corner. Here's some sample C code that fills with random color and quits on SDL_KEYDOWN, along with the config.log from when I built SDL2. Anything missing here? Should I file a bug? https://gist.github.com/magaio/76d26b0be8ca360366ab I also notice these symptoms using PySDL2. |
|||||||||||
|
Raspberry Pi: Can't grab keyboard input |
gabomdq
|
Try installing and running "evtest", and see if you get events from that. Run it on the console with the X server stopped.If you do get events, lets say from the device at /dev/input/event3, you can also try:
udevadm info --path=/sys/class/input/event3 | grep ID_INPUT_KEYBOARD You should get: E: ID_INPUT_KEYBOARD=1 If any of that fails, SDL won't recognize the keyboard. If everything works and you still don't get keyboard events, let me know. 2014-07-03 1:28 GMT-03:00 accumulator:
-- Gabriel. |
|||||||||||||
|
Raspberry Pi: Can't grab keyboard input |
gabomdq
|
Did you build SDL yourself? If you are running evtest in the same way (same user, etc) than your SDL app, and evtest works, SDL should work too if it has EVDEV and UDEV support enabled.
2014-07-04 14:27 GMT-03:00 accumulator:
-- Gabriel. |
|||||||||||||
|
accumulator
|
I did build it myself, yes. This was just a fresh, vanilla Raspbian install. I attached my config.log in my first post to see if anyone might catch something I overlooked. I'm pretty sure I installed the correct -dev packages before configuring and building. I wouldn't need explicit configure flags to turn it on, right? It looks like SDL_INPUT_LINUXEV got defined during configure, which I would think would be enough to turn it on during build.
|
|||||||||||
|
Raspberry Pi: Can't grab keyboard input |
gabomdq
|
You don't have libudev-dev installed:
configure:21254: checking libudev.h usability configure:21254: gcc -c -g -O2 -Iinclude -I/home/pi/Downloads/SDL2-2.0.3/include  -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux  -Iinclude -I/home/pi/Downloads/SDL2-2.0.3/include  conftest.c >&5 conftest.c:146:21: fatal error: libudev.h: No such file or directory Try installing it and build again. 2014-07-04 15:33 GMT-03:00 accumulator:
-- Gabriel. 2014-07-04 15:33 GMT-03:00 accumulator:
-- Gabriel. |
|||||||||||||||
|
accumulator
|
Weird, how did I miss that? Surely configure would've reported and returned non-zero at the end?
Anyway, when I went to install libudev-dev, it was already installed, so I probably have mixed some steps up somewhere. I'll remove my build directory and try from scratch and report back. Thanks - |
|||||||||||
|
accumulator
|
Gabriel - case closed! After a clean rebuild and install, my example works correctly and exits on keydown. Incidentally, the mouse cursor tracks my mouse at the console - way cool. :)
I think what happened was this: 1. I did an initial ./configure without libevdev-dev or libudev-dev installed 2. I realized I needed these libraries but only installed libevdev-dev. 3. Reran ./configure and missed the error message (but I feel like it exited with 0). 4. Another make and make install It seemed that having libevdev-dev installed defined SDL_INPUT_LINUXEV but somehow safely built without libudev support. I'll try to reproduce the conditions and file a bug if necessary. Thanks a lot for taking the time to help me diagnose. |
|||||||||||
|