Trying to use spi touchscreen with osmc

Hello everyone,
I am trying to use a SPI touchscreen on a raspberry pi 3 b with osmc. Just to clarify this a little bit: The LCD itself works with HDMI and is connected to the HDMI port of the pi. This works perfectly fine. The part that doesn’t work is the touch. The Screen has touch and utilises an XPT2046 touchscreen controller that is connected to the pi via SPI on the GPIO pins of the pi. The problem I’m having, is that the default driver for the touch uses and requires X11 and xinput, both are of cause not actually running with osmc. So I can’t use the default drivers.
I found a project on github that can read the information of the xpt2046 with a python script and tried to adapt this script in order to control osmc. This has not really worked out very well. I tried to send keyboard commands lik up, down, left, right to kodi, when Í move my finger in a certain way across the screen. This did not really work though, as it always did all sorts of things and not just one…
So is there maybe some sort of python library that basically emulates a usb mouse.

I realised that I probably should just describe my project here. So basically I’m trying to make a ‘CarPi’ project, where the Raspberry Pi running osmc is placed in a car and basically replaces the radio. The Raspberry Pi is connected to an lcd touchscreen, a gps module, a can-bus module and an amplifier. So using a mouse or keyboard is not an option as I need to be able to use it while driving, at least to some extend. I am also running navit, when needed. For that I have a python script, that just checks if a button in the menu is clicked and than stops the mediacenter process, waits until it has stopped and than just runs ‘startx navit’ which will start a xserver and run navit on it. When navit is closed, the xserver shuts down automatically and when this is detected by the script, it just starts mediacenter again.

PS: I have already tried uinput, which also doesn’t work as it’s trying to read the screen size using x11 commands. And I also know that OSMC isn’t really meant to be used with a mouse, but in my case a remote control wouldn’t make any sense and would not be practical.

Just to clarify this:

LCD: working (uses HDMI)

TOUCH: NOT working (uses SPI)

Interfacing with the TOUCH-controller: working (using a python script)

Sending the data from the TOUCH-controller to OSMC or X11: THAT is the problem and what the question is about.

Please read the whole post, to understand the problem.

OSMC doesn’t use X11, so the screen won’t work unfortunately.

Thanks for your reply, but I think you haven’t understood my question correctly.
I know that osmc doesn’t use X11.
The screen DOES infact work, as it uses HDMI.
I am only asking of a way to use the TOUCH part of the screen. That uses SPI and as the TOUCH itself doen’t require anything X11 related there should be a way to get it to work.
As I wrote in my question, I DO have a python script that runs on OSMC and CAN read the TOUCH-controllers data.

Please read the full question and not just the title!

PS: Sorry for the capitalization, but I don’t like people that just read the title and think they know exactly whats going on. All the text I wrote, to help someone to understand my problem. And I can tell that you haven’t understood the problem and probably haven’t even read the full question.

Take a look at pygame. Perhaps you’ll find something there.

A quick search found some “from screen to GPIO” python code: Jeremy's Blog: Raspberry Pi Pygame UI basics

Good luck.

I’d suggest that you talk with the author of the script you are trying to use. And you need to get a better understanding of the OS and terminology. You are not trying to control osmc with a script I suspect, but you are trying to control Kodi. OSMC is the linux distribution that includes Kodi.

Sorry if our free support does not meet your expectations. As I stated you should contact the author of the script you are trying to use.

Best you can do is expose the touchscreen as an evdev device.

Thank You for your replies.
Evdev seems to be a good option. I am currently struggling to get it to actually create a mouse cursor and move it. I have tried sending regular keystrokes and that worked. Now I am trying to use the absolute x and y features to send a position, but I am not getting a cursor to show up and the button at that position is not highlighted either. I don’t know if that is some sort of compatibility problem between evdev and osmc or if I’m just missing something I need to do…

Keep in mind that mouse support on skins in Kodi isn’t great.