Touch input flipped

Hello everyone
First off can I say how amazing osmc is.

Iv been using it for a long time but last week my screen died. I got my self a new 10.1 waveshare one, unfortunately I didn’t realize the there are compatality issues when using X11 and that’s what the driver uses as it’s a XPT2046.

However after days of trawling through the forums I made progress. I got the touch. Screen working. But the input was wrong on xy. I updated the config.txt with some stuff to make the xy swap.

Do now I nearly have a functional touchscreen, but the problem is that the y axis is flipped. Top is bottom and bottom top.

I tryed rotating the screen but of course this just made the X axis of the touch be inverted instead. So my question is this. Is there anyway to flip the touch y axis? Maybe just a quick hack in osmc to do something like touch_y = screen height - touch_y?

Now iv spent so long on this and installed so many packages i cannot remember what has made it work so I’m reputed to reinstall as this could take me ages to get working again. However if I have to I will probably be able to find out at least what’s making it work, but I was wondering if anyone has any suggestions before I go down that road.

Many thanks matt.