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