From dc006dcd9aeec6af89737841603e6cfd83289978 Mon Sep 17 00:00:00 2001 From: sragneau Date: Wed, 24 Jun 2026 07:41:08 +0200 Subject: [PATCH] Fix Qt touch rotation when using display_lcd_rotate=2 on Venus OS 3.73+ When the alternate rotate command (display_lcd_rotate=2) is chosen, the display rotates but the touchscreen does not. On Venus OS 3.73+, ts_calibrate cannot display calibration targets because the KMS framebuffer is not accessible without the GUI running. Fix: inject QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS with rotate=180 into start-gui.sh when altRotateDisplay is active. This makes Qt rotate touch events to match the display rotation without requiring ts_calibrate. The patch is applied/removed automatically on each install/reinstall, so it survives Venus OS updates (which overwrite start-gui.sh). Co-Authored-By: Claude Sonnet 4.6 --- setup | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/setup b/setup index 6cbfa8e..1088a73 100755 --- a/setup +++ b/setup @@ -392,8 +392,24 @@ if [ $scriptAction == 'INSTALL' ]; then echo "display_hdmi_rotate=2" >> "$configFile.tmp" fi fi - echo "#### RpiDisplaySetup end" >> "$configFile.tmp" - + echo "#### RpiDisplaySetup end" >> "$configFile.tmp" + + # patch start-gui.sh for Qt touch rotation when display_lcd_rotate is used + startGuiSh="/opt/victronenergy/gui/start-gui.sh" + if [ -f "$setupOptionsDir/altRotateDisplay" ]; then + if ! grep -q "QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS" "$startGuiSh" 2>/dev/null; then + logMessage "patching start-gui.sh for Qt touch rotation 180" + sed -i 's|export QT_QPA_PLATFORM=linuxfb|export QT_QPA_PLATFORM=linuxfb\n\texport QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS=/dev/input/touchscreen0:rotate=180|' "$startGuiSh" + restartGui=true + fi + else + if grep -q "QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS" "$startGuiSh" 2>/dev/null; then + logMessage "removing Qt touch rotation patch from start-gui.sh" + sed -i '/QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS/d' "$startGuiSh" + restartGui=true + fi + fi + # detect changes cmp -s $configFile "$configFile.tmp" > /dev/null if (( $? == 1 )); then