Rotate touchscreen in CLI mode

Rotate touchscreen in CLI mode

I’m asking for the help with my problem. I’m developing a Qt GUI application, that will run on Raspberry Pi 4 as an embedded device. I need to run my app at boot without showing the desktop to the user. My main goal is: when the device is booting, it should display my custom splash screen until my Qt application shows on’ the screen. No desktop visible or any boot text in the process, users doesn’t need to even know it’s a linux and Raspberry Pi that everthing’s running on. So I managed to get rid of all boot messages and logos I don’t need by replacing drivers/video/logo/logo_linux_clut224.ppm in my kernel to my own custom logo graphic, recompiling it and modifying the /boot/cmdline.txt. As I need to prevent the user from interacting the desktop and doesn’t really need it in my project I was advised to run my Qt app in CLI mode, rendering it directly in the framebuffer. So I switched my Raspberry to boot in CLI autologin in raspi-config and add a service which runs my app at boot with a -platform linuxfb option. Everything works as expected, my custom splash screen is displayed for the entire boot until my app shows.

The problem is I need the app to run in portrait mode. Rotating the display was easy, as I only needed to add display_rotate=1 in /boot/config.txt. But the touchscreen stayed in landscape mode and I can’t find a way to rotate it. All the solutions I can find use xinput to rotate the touchscreen or add the Option "TransformationMatrix" to the /usr/share/X11/xorg.conf.d/40-libinput.conf which I can’t use because I don’t have a X server running.

Can anyone tell me how can I rotate the touchscreen without X server?

Thanks.

Go to Source
Author: Piotr