SDL2 and Hyperpixel Input Event Support



The touch screen serves as a mouse in X11, but is there intended to be support for use in SDL2 without X11? (e.g. SDL2 driving the display for OpenGLES and handling input itself?

At present, I get

INFO: The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list EVDEV KeyCode 330

messages returned

George Russell


There’s no way, to my knowledge, for us to support SDL. The touchscreen is emitting the correct events for a uinput touchscreen device- in fact it’s an event-by-event clone of the Official Raspberry Pi Touchscreen driver, just implemented in Python. If SDL doesn’t work with it, then I guess SDL simply doesn’t support multitouch devices?

My solution for input- since Python’s PyGame has similar issues working with touchscreens (presumably because it’s SDL under the hood) - is to read the uinput device directly. I wrote a Python library to this end for the Official Touchscreen which also happens to work with Hyper Pixel, but may not be much use if you’re using any other language:

Depending on what you’re doing, you might as well kill the uinput driver altogether and just read either the touch position data, or the raw ADC data right out of Hyper Pixel directly over I2C. The whole touch driver is just Python, laid bare for you to integrate right into your app:

Reading the touch x1/y1 and x2/y2 positions is easy enough:

Although we read directly from the touchscreens ADC to determine when a touch finishes:


Now that I look closer at the SDL touch screen support, it is working; the complaint is merely a warning.

I can seem to happily read finger up / down / motion in SDL 2.0.5+ (SDL trunk, but should also work in 2.0.5)


Nice! I need to tinker with this stuff again sometime.