start-with-fb-check.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. # Startup wrapper that waits for framebuffer to be ready
  3. SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  4. MAX_WAIT=30 # Maximum 30 seconds to wait for framebuffer
  5. echo "🖥️ Waiting for framebuffer device to be ready..."
  6. # Wait for framebuffer device to exist and be accessible
  7. WAITED=0
  8. while [ $WAITED -lt $MAX_WAIT ]; do
  9. if [ -c /dev/fb0 ]; then
  10. echo "✅ Framebuffer /dev/fb0 is ready"
  11. # Additional check: try to read framebuffer info
  12. if command -v fbset >/dev/null 2>&1; then
  13. if fbset -fb /dev/fb0 >/dev/null 2>&1; then
  14. echo "✅ Framebuffer is initialized and readable"
  15. break
  16. else
  17. echo "⏳ Framebuffer exists but not fully initialized (${WAITED}s)..."
  18. fi
  19. else
  20. # If fbset not available, just check device existence
  21. echo "✅ Framebuffer device exists (fbset not available for detailed check)"
  22. break
  23. fi
  24. else
  25. echo "⏳ Waiting for framebuffer device (${WAITED}s)..."
  26. fi
  27. sleep 1
  28. WAITED=$((WAITED + 1))
  29. done
  30. if [ $WAITED -ge $MAX_WAIT ]; then
  31. echo "❌ Timeout waiting for framebuffer after ${MAX_WAIT}s"
  32. echo "⚠️ Starting anyway - application may fail"
  33. fi
  34. # Additional delay for DRM/KMS subsystem to stabilize
  35. echo "⏳ Waiting for graphics subsystem to stabilize..."
  36. sleep 2
  37. echo "🚀 Starting Dune Weaver Touch..."
  38. cd "$SCRIPT_DIR"
  39. # Configure Qt platform environment variables
  40. export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0
  41. export QT_QPA_FONTDIR=/usr/share/fonts
  42. # Touch rotation is now handled by QML transform - don't rotate evdev input
  43. # (Rotation happens in main.qml via transform: Rotation)
  44. exec ./venv/bin/python main.py