Described below is the process to calibrate touch screen hardware on a TI Sitara target, but it should apply to other Linux targets using ts_lib.
You may need change makefile and/or source code in different platforms.
Here are some assumptions:
1) tslib is installed on the target, and frame buffer is used for drawing.
2) The proper toolchain is installed on /opt/timesys/am335x_evm/toolchain (change the makefile if the toolchain is at other location)
Build the attached code (ts_cal).
When running the binary on the target, you’ll see some crosshairs are drawn in sequence on the screen.
These 3 crosshairs are at 15%,15%, 85%,50%, and 50%,85% of the screen when top/left corner is used as the origin.
The first 3 crosshairs are for calibration. Use the stylus to touch them (don’t stay long, tap and leave right away, or you may get wrong readings).
The next 3 crosshairs are used for verification. You may need run the binary again till verification indicates the result is good enough.
Use the generated string to replace the content in egl_md.h (note, the content is the captured raw data divided by two).
You can change it for each design (generated code for each design will have egl_md.h), or you can change it once for all in the target installed folder (then all generated code will use that egl_md.h).
Another way as indicated from os_Wrapper.c, you can specify system environment variable LINUX_INPUT_DEVICES before run HMI generated code.
Attached please find:
1 - console output screenshot of one ts_cal run
2 - ts_cal.tar.gz