#!/bin/sh

. /ts4700.subr

let model=$model\&0xffff
# model must be 0x4700
if test $model -ne 18176; then
  exit 0
fi
let baseboard_model=$baseboard_model\&0x3f

VIDMODE="800x480M"
TSLCDPARAM=""
SPLASH="splash-800x480.gz"
XORG="/xorg-800x480.conf"
if test $baseboard_model -eq 1 -o $baseboard_model -eq 2; then
  VIDMODE="800x480M"
elif test $baseboard_model -eq 10; then
  VIDMODE="800x600"
  XORG="/xorg-800x600.conf"
elif test $baseboard_model -eq 5; then
  VIDMODE="640x480M"
  TSLCDPARAM="swapxy=1 negx=1"
  SPLASH="splash-640x480.gz"
  XORG="/xorg-640x480.conf"
else
  exit 0
fi


TMP=0
while test $TMP -lt 100 -a -e /mnt/root/notrootfs; do
  TMP=$((TMP+1))
  usleep 100000
done
if [ ! -e /mnt/root/notrootfs ]; then
  (do_splash)
  rm -f /tmp/.X0-lock /tmp/.X11-unix
  Xorg -br -logfile /dev/null -config $XORG &
  TMP=0
  while test $TMP -lt 100 -a ! -e /tmp/.X0-lock; do
    TMP=$((TMP+1))
    usleep 100000
  done
  sleep 1 
  icewm-session &
  xhost +
fi
