瀏覽代碼

Skip udev touch rotation on Pi 5 (QML handles it)

Pi 5 uses QML rotation which automatically transforms touch events.
The udev rule was causing double rotation on touch input.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
tuanchris 1 月之前
父節點
當前提交
c33639b99b
共有 1 個文件被更改,包括 22 次插入9 次删除
  1. 22 9
      dune-weaver-touch/install.sh

+ 22 - 9
dune-weaver-touch/install.sh

@@ -162,8 +162,20 @@ setup_touch_rotation() {
 
 
     local UDEV_RULE_FILE="/etc/udev/rules.d/99-ft5x06-rotate.rules"
     local UDEV_RULE_FILE="/etc/udev/rules.d/99-ft5x06-rotate.rules"
 
 
-    # Create udev rule for FT5x06 touch controller (180° rotation)
-    cat > "$UDEV_RULE_FILE" << 'EOF'
+    # Pi 5 with linuxfb: QML handles rotation (including touch transform)
+    # Pi 3/4: Use udev rule for touch rotation to match kernel framebuffer rotation
+    if [ "$IS_PI5" = true ]; then
+        echo "   ℹ️  Pi 5 detected - touch rotation handled by QML, skipping udev rule"
+        # Remove any existing touch rotation rule
+        if [ -f "$UDEV_RULE_FILE" ]; then
+            rm -f "$UDEV_RULE_FILE"
+            udevadm control --reload-rules
+            udevadm trigger
+            echo "   ✅ Removed existing touch rotation udev rule"
+        fi
+    else
+        # Create udev rule for FT5x06 touch controller (180° rotation)
+        cat > "$UDEV_RULE_FILE" << 'EOF'
 # Rotate FT5x06 touchscreen 180 degrees using libinput calibration matrix
 # Rotate FT5x06 touchscreen 180 degrees using libinput calibration matrix
 # Matrix format: a b c d e f 0 0 1
 # Matrix format: a b c d e f 0 0 1
 # For 180° rotation: -1 0 1  0 -1 1  0 0 1
 # For 180° rotation: -1 0 1  0 -1 1  0 0 1
@@ -172,15 +184,16 @@ SUBSYSTEM=="input", KERNEL=="event*", ATTRS{name}=="*generic ft5x06*", \
   ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1  0 -1 1  0 0 1"
   ENV{LIBINPUT_CALIBRATION_MATRIX}="-1 0 1  0 -1 1  0 0 1"
 EOF
 EOF
 
 
-    chmod 644 "$UDEV_RULE_FILE"
-    echo "   ✅ Touch rotation udev rule created: $UDEV_RULE_FILE"
+        chmod 644 "$UDEV_RULE_FILE"
+        echo "   ✅ Touch rotation udev rule created: $UDEV_RULE_FILE"
 
 
-    # Reload udev rules
-    udevadm control --reload-rules
-    udevadm trigger
-    echo "   ✅ Udev rules reloaded"
+        # Reload udev rules
+        udevadm control --reload-rules
+        udevadm trigger
+        echo "   ✅ Udev rules reloaded"
 
 
-    echo "   👆 Touch rotation configured (180°)"
+        echo "   👆 Touch rotation configured (180°)"
+    fi
 }
 }
 
 
 # Function to hide mouse cursor
 # Function to hide mouse cursor