Waveshare touchscreen user space driver
I brought a Waveshare 7-inch HDMI LCD and it provides touchscreen through USB. Unfortunately, dvd with raspbian images for raspberry was completely unreadable, so I decided to google problem and have found solution.
But I thought, that writing driver in Python is completely bad idea, and that driver imitated just mouse, not touchscreen, as I needed for my project. So, I decided to implement user space uinput driver, that implements simple (type A) protocol from linux documetation.
- libsuinput, version >= 0.6.1
- pthread
- C99 compiler
- libudev
gcc -std=c99 -Wall ./waveshare.c -pthread -lsuinput -ludev -o waveshare-touch-driver
-
Copy file to the path
sudo cp waveshare-touch-driver /usr/local/bin/waveshare-touch-driver
-
Edit
/etc/rc.local
file and append:/usr/local/bin/waveshare-touch-driver
-
Edit /etc/modules and append neccessary
uinput
kernel module -
Reboot
- Sometimes touchscreen is really buggy. This driver does not perform any data correction
- For now "clean"
/dev/input/eventX
source is almost useless for X applications, and you should use additional driver for implementing touchscreen support in X. However it is useful to launch Qt applications in EGLFS mode. Just addQT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/eventX
to environment variables (where X is device number)