@echo off
echo setting the ELO Touch driver that connect on Fintek F81216D serial port
if "%1" == "3" goto begin
if "%1" == "1" goto begin
if "%1" == "2" goto begin
if "%1" == "4" goto begin

:Show_help
echo.
echo. Command example: F81216D.BAT x
echo.     x=1-4 (Setting the driver that use Fintek F81216D serial port No.x.)
goto Error_Break

:begin
F81216IF
if errorlevel 1 goto DONE
@echo Find F81216D device.
call 1216set.bat
del  1216set.bat
elodev 2210,0
nomouse
echo.

if not "%1" == "3" goto F81216C4
:F81216C3
echo ucomtsr %F81216C3IO% %F81216C3IRQ%
     ucomtsr %F81216C3IO% %F81216C3IRQ%
goto F81216Check

if not "%1" == "4" goto F81216C1
:F81216C4
echo ucomtsr %F81216C4IO% %F81216C4IRQ%
     ucomtsr %F81216C4IO% %F81216C4IRQ%
goto F81216Check

if not "%1" == "1" goto F81216C2
:F81216C1
echo ucomtsr %F81216C1IO% %F81216C1IRQ%
     ucomtsr %F81216C1IO% %F81216C1IRQ%
goto F81216Check

:F81216C2
echo ucomtsr %F81216C2IO% %F81216C2IRQ%
     ucomtsr %F81216C2IO% %F81216C2IRQ%

:F81216Check
if errorlevel 1 goto F81216NotFound
if exist ELOGRAPH.CAL goto NoEloCalib
echo.
echo    Please save ELOCALIB but don't update AUTOEXEC.BAT after next step
echo.
pause
elocalib

:NoEloCalib
monmouse
movement

goto DONE

:F81216NotFound
echo ###  Error! No find the ELO Touch controller in F81216 No.%1 serial port  ###
goto DONE

:Error_Break
set errorlevel=1

:DONE
@echo on
