Kaynağa Gözat

Use linuxfb backend for all Pi models

Simplifies display backend - linuxfb works reliably on all Pi models
including Pi 5 where eglfs has EGL surface creation issues.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
tuanchris 1 ay önce
ebeveyn
işleme
55694bdebe

+ 2 - 12
dune-weaver-touch/dune-weaver-touch.service

@@ -2,29 +2,19 @@
 Description=Dune Weaver Touch Interface
 After=multi-user.target network-online.target
 Wants=network-online.target
-# Wait for DRM/KMS devices to be ready
-After=systemd-udev-settle.service
-Wants=systemd-udev-settle.service
 
 [Service]
 Type=simple
 User=pi
 Group=pi
 WorkingDirectory=/home/pi/dune-weaver-touch
-Environment=DISPLAY=:0
-Environment=QT_QPA_PLATFORM=eglfs
-Environment=QT_QPA_EGLFS_ALWAYS_SET_MODE=1
-Environment=QT_QPA_EGLFS_HIDECURSOR=1
+Environment=QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0
 Environment=QT_QPA_FB_HIDECURSOR=1
-Environment=QT_QPA_EGLFS_INTEGRATION=eglfs_kms
-Environment=QT_QPA_EGLFS_KMS_ATOMIC=1
-Environment=QT_QPA_EGLFS_KMS_CONFIG=/home/pi/dune-weaver-touch/eglfs_config.json
 ExecStart=/home/pi/dune-weaver-touch/venv/bin/python /home/pi/dune-weaver-touch/main.py
 Restart=always
 RestartSec=10
-# Restart on failure with backoff
 StartLimitInterval=200
 StartLimitBurst=5
 
 [Install]
-WantedBy=multi-user.target
+WantedBy=multi-user.target

+ 25 - 6
dune-weaver-touch/install.sh

@@ -61,13 +61,32 @@ install_scripts() {
 setup_systemd() {
     echo "🚀 Setting up systemd service..."
 
-    # Update paths in the service file
-    sed "s|/home/pi/dune-weaver-touch|$SCRIPT_DIR|g" "$SCRIPT_DIR/dune-weaver-touch.service" > /tmp/dune-weaver-touch.service
-    sed -i "s|User=pi|User=$ACTUAL_USER|g" /tmp/dune-weaver-touch.service
-    sed -i "s|Group=pi|Group=$ACTUAL_USER|g" /tmp/dune-weaver-touch.service
+    local SERVICE_FILE="/etc/systemd/system/dune-weaver-touch.service"
 
-    # Copy service file
-    cp /tmp/dune-weaver-touch.service /etc/systemd/system/
+    # Generate service file with linuxfb backend (works on all Pi models)
+    echo "   ℹ️  Using linuxfb backend"
+    cat > "$SERVICE_FILE" << EOF
+[Unit]
+Description=Dune Weaver Touch Interface
+After=multi-user.target network-online.target
+Wants=network-online.target
+
+[Service]
+Type=simple
+User=$ACTUAL_USER
+Group=$ACTUAL_USER
+WorkingDirectory=$SCRIPT_DIR
+Environment=QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0
+Environment=QT_QPA_FB_HIDECURSOR=1
+ExecStart=$SCRIPT_DIR/venv/bin/python $SCRIPT_DIR/main.py
+Restart=always
+RestartSec=10
+StartLimitInterval=200
+StartLimitBurst=5
+
+[Install]
+WantedBy=multi-user.target
+EOF
 
     # Enable service
     systemctl daemon-reload

+ 6 - 20
dune-weaver-touch/run.sh

@@ -57,27 +57,13 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
     echo "   Platform: macOS (using native cocoa backend)"
     export QT_QPA_PLATFORM=""  # Let Qt use default
 elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
-    # Linux - check for DRM devices to determine if eglfs is available
-    if [ -e /dev/dri/card0 ] || [ -e /dev/dri/card1 ]; then
-        echo "   Platform: Linux with DRM (using eglfs backend)"
-        export QT_QPA_PLATFORM=eglfs
-        export QT_QPA_EGLFS_INTEGRATION=eglfs_kms
-        export QT_QPA_EGLFS_KMS_ATOMIC=1
-        export QT_QPA_EGLFS_HIDECURSOR=1
-        export QT_QPA_EGLFS_ALWAYS_SET_MODE=1
-
-        # Touch rotation is handled by udev rule: /etc/udev/rules.d/99-ft5x06-rotate.rules
-        # The rule applies a libinput calibration matrix for 180° rotation
-
-        # Use eglfs_config.json with corrected connector name (DSI-1)
-        if [ -f "$SCRIPT_DIR/eglfs_config.json" ]; then
-            echo "   Using eglfs config: $SCRIPT_DIR/eglfs_config.json"
-            export QT_QPA_EGLFS_KMS_CONFIG="$SCRIPT_DIR/eglfs_config.json"
-        else
-            echo "   EGLFS mode: Auto-detection (no config file)"
-        fi
+    # 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
+        export QT_QPA_FB_HIDECURSOR=1
     else
-        echo "   Platform: Linux without DRM (using xcb/X11 backend)"
+        echo "   Platform: Linux (using xcb/X11 backend)"
         export QT_QPA_PLATFORM=xcb
     fi
 else