0

I'm looking at a project where I will need to drive two separate displays from a Pi, both of which are touchscreen - specifically GT911 type on a separate I2C connection.

This will almost certainly be driven by a Pi4, but I'm not familiar with how you can integrate the I2C drivers for two identical screens such that the I2C devices are tied to the correct screen.

It's not a problem (for the project) to use 2 different I2C interfaces, perhaps even the two HDMI_I2C channels if that's allowed - the docs/info I've found so far has been either vague or contradictory.

How's best to go about this? I'd like to avoid major kernel/driver hackery if possible to keep things compatible/maintainable.

1
  • The Pi4 has 5 or 6 independent I2C interfaces, so that part should not be a problem. I haven't used this type of display, though, so I don't know how to configure the drivers.
    – PMF
    Dec 10, 2020 at 7:10

1 Answer 1

0

Well it turned out to be fairly easy although arriving at the easy solution was quite hard...

From userspace with a simple python script we read the two I2C touchscreen devices, manipulate their reported coordinates as we need, and then inject them as touch events directly using the 'uinput' module*, an interface to /dev/uinput - you can also do this in C in a very similar way, and existing driver code gives most of the info you need.

The same library can inject keyboard and mouse events too, it's surprisingly easy and very useful for a lot of embedded stuff where adding USB ports for mice/keyboards may not be posible.

*= It's worth noting that there's multiple python libraries for uinput; some that only handle keyboard & mouse injection, plus #from evdev import UInput is != import uinput and the example code for one will not work with the other.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.