#!/bin/sh

# test_pixels.sh
# 2010-09-29
# by Gernot WALZL

# Using this script it should be easy to locate any dead pixels on a LCD.


SLEEP=10
LOOPS=3

COMMAND="X -noreset :1"
$COMMAND &
sleep 3
for i in $(seq $LOOPS); do
  xsetroot -solid "#000000" -d :1 || exit 1
  sleep $SLEEP
  xsetroot -solid "#FF0000" -d :1 || exit 1
  sleep $SLEEP
  xsetroot -solid "#00FF00" -d :1 || exit 1
  sleep $SLEEP
  xsetroot -solid "#0000FF" -d :1 || exit 1
  sleep $SLEEP
  xsetroot -solid "#00FFFF" -d :1 || exit 1
  sleep $SLEEP
  xsetroot -solid "#FF00FF" -d :1 || exit 1
  sleep $SLEEP
  xsetroot -solid "#FFFF00" -d :1 || exit 1
  sleep $SLEEP
  xsetroot -solid "#FFFFFF" -d :1 || exit 1
  sleep $SLEEP
done
PID=$(ps ax | grep "$COMMAND" | grep -v "grep" | awk '{print $1}')
if [ "$PID" != "" ]; then
  kill "$PID"
fi