Can I use the Hyperpixel touch screen with the Kivy GUI library without X server?


#1

Please humour me if I’m asking stupid questions, I’m not a Linux expert by any measure!

I’ve got my Hyperpixel installed and working on Raspbian Jessie Lite on a RPi Zero W, and I’ve managed to get some Python code responding to touch events by following the advice here and running the example script provided in the repository README for the driver.

When I run the example script, I can touch the screen and see all of my touches and movements written to the console. So far so good!

However, when I run a Kivy GUI app, the controls don’t respond to touches at all. From what I can gather, Kivy apps are generally run from within an X desktop environment, but I’m not doing this (just running the app directly from the terminal).

My question is, is this even possible, or am I barking up the wrong tree? I’ve been reading for an hour or so but to be honest I’m not sure what to search for… I’ve found some stuff about Kivy input providers but again I’m not quite sure if this is the right direction or not.

A bit of beginner help (or even just some pointers to the correct reading material) would be much appreciated!

Thanks,
Mark


#2

I believe input providers is the right direction, HyperPixel Touch is probably /dev/input/event0 or /dev/input/event1, you can usually find out which by running dmesg | grep Touchscreen.


#4

Thank you. I’ll have a look into the input provider route and update this thread with any progress!


#5

I’m trying to do similar with my project. I don’t need touch co-ordinates (but they’ll come in handy later on, perhaps), but I got a touch listener with very basic functionality working by using the following blob of Python.

import evdev
device = evdev.InputDevice('/dev/input/event0') 
for event in device.read_loop():
    if(event.type == 3 and event.code == 57 and event.value == 00):
        print(event)
        print('screen touch detected');

The filtering on three properties was simply a hacky way of limiting the number of events I cared about. I don’t know what those values actually mean (the evdev docs are not good in that respect) but it seems to work well enough for my current needs.


#6

Ok, I got it working! The information here seems to work fine for the HyperPixel as well as for the official touchscreen.

So, for reference, you need to edit ~/.kivy/config.ini and replace the existing contents of the [input] section with:

mouse = mouse
mtdev_%(name)s = probesysfs,provider=mtdev
hid_%(name)s = probesysfs,provider=hidinput

#7

can confirm works fine !