#!/bin/bash WORKS= FAILS= for i in $(seq 100); do sudo sh -c "echo modeset $i start > /dev/kmsg" for output in $(xrandr | grep -o ^DP[A-Z0-9-]*); do xrandr --output $output --off done sleep 1 xrandr --auto sleep 1 read -n 1 -rsp "works? (y/N) " echo if [[ $REPLY =~ ^[Yy]$ ]]; then sudo sh -c "echo modeset $i result: works > /dev/kmsg" echo "modeset $i works:" >> xrandr.log WORKS=1 else sudo sh -c "echo modeset $i result: fails > /dev/kmsg" echo "modeset $i fails:" >> xrandr.log FAILS=1 fi xrandr --verbose >> xrandr.log if [[ -n "$WORKS" && -n "$FAILS" ]]; then break fi done sudo dmesg >> dmesg.log