Przeglądaj źródła

Add 180° rotation for Pi 5 linuxfb backend

Pi 5's cmdline.txt video rotation doesn't apply to Qt linuxfb,
so we need to explicitly set rotation=180 in the Qt platform string.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
tuanchris 1 miesiąc temu
rodzic
commit
6e8cf3b70a
2 zmienionych plików z 19 dodań i 4 usunięć
  1. 10 2
      dune-weaver-touch/install.sh
  2. 9 2
      dune-weaver-touch/run.sh

+ 10 - 2
dune-weaver-touch/install.sh

@@ -64,7 +64,15 @@ setup_systemd() {
     local SERVICE_FILE="/etc/systemd/system/dune-weaver-touch.service"
 
     # Generate service file with linuxfb backend (works on all Pi models)
-    echo "   ℹ️  Using linuxfb backend"
+    # Pi 5 needs explicit rotation since cmdline.txt rotation doesn't apply to Qt linuxfb
+    local QT_PLATFORM="linuxfb:fb=/dev/fb0"
+    if [ "$IS_PI5" = true ]; then
+        QT_PLATFORM="linuxfb:fb=/dev/fb0:rotation=180"
+        echo "   ℹ️  Using linuxfb backend with 180° rotation (Pi 5)"
+    else
+        echo "   ℹ️  Using linuxfb backend"
+    fi
+
     cat > "$SERVICE_FILE" << EOF
 [Unit]
 Description=Dune Weaver Touch Interface
@@ -76,7 +84,7 @@ Type=simple
 User=$ACTUAL_USER
 Group=$ACTUAL_USER
 WorkingDirectory=$SCRIPT_DIR
-Environment=QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0
+Environment=QT_QPA_PLATFORM=$QT_PLATFORM
 Environment=QT_QPA_FB_HIDECURSOR=1
 ExecStart=$SCRIPT_DIR/venv/bin/python $SCRIPT_DIR/main.py
 Restart=always

+ 9 - 2
dune-weaver-touch/run.sh

@@ -59,8 +59,15 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
 elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
     # Linux/Raspberry Pi - use linuxfb for all Pi models
     if [ -e /dev/fb0 ]; then
-        echo "   Platform: Linux (using linuxfb backend)"
-        export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0
+        # Check if Pi 5 - needs explicit rotation
+        PI_MODEL=$(cat /proc/device-tree/model 2>/dev/null | tr -d '\0' || echo "unknown")
+        if [[ "$PI_MODEL" == *"Pi 5"* ]]; then
+            echo "   Platform: Raspberry Pi 5 (using linuxfb with 180° rotation)"
+            export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:rotation=180
+        else
+            echo "   Platform: Linux (using linuxfb backend)"
+            export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0
+        fi
         export QT_QPA_FB_HIDECURSOR=1
     else
         echo "   Platform: Linux (using xcb/X11 backend)"