#!/bin/sh
echo "xinput --set-prop \"eGalaxTouch Virtual Device for Single\" 113 0" > /tmp/.xinitrc
cat /home/pi/.xinitrc >> /tmp/.xinitrc
# touchscreen controller
touch_dev=`cat /tmp/hw.config | grep touchscreen`
if test $touch_dev = "touchscreen=egalax1"
then
	if test -e /home/pi/SSD
	then
		export DISPLAY=:0
	else 
		export DISPLAY=:0
		export HOME=/tmp
	fi
	xinput_calibrator
fi
if test $touch_dev = "touchscreen=ilitek-tp"
then
	if test -e /home/pi/SSD
	then
		export DISPLAY=:0
	else 
		export DISPLAY=:0
		export HOME=/tmp
	fi
	xinput_calibrator
fi

if test $touch_dev = "touchscreen=egalax2"
then
        # configuration of STP-RAP45U2U-S series touch controller
	if test -e /home/pi/SSD
	then
		export DISPLAY=:0
	else 
		export DISPLAY=:0
		export HOME=/tmp
	fi
	sudo -E /home/pi/hwconf/eCalib Linz9
fi
