This commit is contained in:
2026-01-09 18:51:22 +00:00
parent de10e1dd1f
commit 3125b77020
7 changed files with 106 additions and 30 deletions

View File

@@ -48,7 +48,7 @@ else
echo "KVM not available, using software emulation (slower)"
fi
# Start QEMU with VirtIO-GPU (VirGL OpenGL acceleration) and serial console
# Start QEMU with multiple displays (3 total) for multi-monitor testing
> "$SERIAL_LOG" # Clear old log
qemu-system-x86_64 \
$KVM_OPTS \
@@ -57,7 +57,9 @@ qemu-system-x86_64 \
-bios /usr/share/qemu/OVMF.fd \
-drive file="$ISO_PATH",media=cdrom \
-drive file="$DISK_PATH",format=qcow2,if=virtio \
-device virtio-vga \
-device virtio-gpu-pci,id=video0 \
-device virtio-gpu-pci,id=video1 \
-device virtio-gpu-pci,id=video2 \
-display none \
-spice port=5930,disable-ticketing=on \
-serial unix:"$SERIAL_SOCK",server,nowait \

View File

@@ -15,35 +15,57 @@ if [ ! -S "$MONITOR_SOCK" ]; then
fi
mkdir -p "$SCREENSHOT_DIR"
PPM_FILE="$SCREENSHOT_DIR/ecoos-$TIMESTAMP.ppm"
PNG_FILE="$SCREENSHOT_DIR/ecoos-$TIMESTAMP.png"
LATEST_FILE="$SCREENSHOT_DIR/latest.png"
echo "Taking screenshot..."
echo "screendump $PPM_FILE" | socat - UNIX-CONNECT:"$MONITOR_SOCK"
sleep 1
# Screenshot all displays (video0, video1, video2)
DISPLAYS="video0 video1 video2"
SCREENSHOTS=()
# Check if PPM was created
if [ ! -f "$PPM_FILE" ]; then
echo "ERROR: Screenshot failed"
exit 1
fi
echo "Taking screenshots of all displays..."
# Convert to PNG if imagemagick is available
if command -v convert &> /dev/null; then
convert "$PPM_FILE" "$PNG_FILE"
rm "$PPM_FILE"
for DISPLAY in $DISPLAYS; do
PPM_FILE="$SCREENSHOT_DIR/ecoos-$TIMESTAMP-$DISPLAY.ppm"
PNG_FILE="$SCREENSHOT_DIR/ecoos-$TIMESTAMP-$DISPLAY.png"
# Copy to latest.png
cp "$PNG_FILE" "$LATEST_FILE"
# Take screenshot of this display
echo "screendump $PPM_FILE $DISPLAY" | socat - UNIX-CONNECT:"$MONITOR_SOCK" 2>/dev/null
sleep 0.5
echo "Screenshot saved: $PNG_FILE"
if [ -f "$PPM_FILE" ]; then
# Convert to PNG if imagemagick is available
if command -v convert &> /dev/null; then
convert "$PPM_FILE" "$PNG_FILE"
rm "$PPM_FILE"
SCREENSHOTS+=("$PNG_FILE")
echo " $DISPLAY: $PNG_FILE"
else
SCREENSHOTS+=("$PPM_FILE")
echo " $DISPLAY: $PPM_FILE"
fi
else
echo " $DISPLAY: (no output or not connected)"
fi
done
# Create a combined image if we have multiple screenshots and imagemagick
if command -v convert &> /dev/null && [ ${#SCREENSHOTS[@]} -gt 1 ]; then
COMBINED_FILE="$SCREENSHOT_DIR/ecoos-$TIMESTAMP-combined.png"
LATEST_FILE="$SCREENSHOT_DIR/latest.png"
# Combine images horizontally
convert "${SCREENSHOTS[@]}" +append "$COMBINED_FILE"
cp "$COMBINED_FILE" "$LATEST_FILE"
echo ""
echo "Combined screenshot: $COMBINED_FILE"
echo "Also saved as: $LATEST_FILE"
elif [ ${#SCREENSHOTS[@]} -eq 1 ]; then
LATEST_FILE="$SCREENSHOT_DIR/latest.png"
cp "${SCREENSHOTS[0]}" "$LATEST_FILE"
echo ""
echo "Also saved as: $LATEST_FILE"
else
echo "Screenshot saved: $PPM_FILE"
echo "(Install imagemagick to auto-convert to PNG)"
fi
# Keep only last 20 screenshots (excluding latest.png)
# Keep only last 20 screenshot sets (excluding latest.png)
cd "$SCREENSHOT_DIR"
ls -t ecoos-*.png 2>/dev/null | tail -n +21 | xargs -r rm -f
ls -t ecoos-*-combined.png 2>/dev/null | tail -n +21 | xargs -r rm -f
ls -t ecoos-*-video*.png 2>/dev/null | tail -n +61 | xargs -r rm -f