Transferred from: http://www.latelee.org/embedded-linux/porting-linux-tslib.html
Some time ago let Tslib Dizzy head, originally everything is version of trouble. This article is just an essay, with the author, feel free to write down the experience of the pen, so do not be serious. As I admire the "ages from," the same as the return. --It is estimated that the Wang Zixian was finished watching the night, and the spirits were gone, and went home.
Gossip is seldom mentioned.
When Tslib, there were many mistakes, like
No raw modules loaded.
Ts_config:success
Selected device is a touchscreen I understand
Ts_read:invalid argument
And so wrong, found a lot of information on the Internet, but unfortunately there is no suitable for me.
The tslib used now is downloaded using git. Note that it is best to use the Linux platform to download, because Tslib contains script files (such as autogen.sh), and Windows and Linux process the end of a line of characters is not the same, so download in Linux, of course, using the editor to convert the end character does not matter.
The command is as follows:
$ git clone https://github.com/kergoth/tslib
Install git under Linux for reference: Linux porting Essay: Using Git.
The compilation process is as follows:
$./autogen.sh
$./configure–host=arm-linux–prefix=/home/latelee/lib/tslib
$ make
$ make Install
The popular compiling methods on the Internet are as follows:
$./autogen.sh
$ echo "Ac_cv_func_malloc_0_nonnull=yes" > Tmp.cache
$./configure–host=arm-linux–cache-file=tmp.cache–enable-inputapi=no–prefix=/home/latelee/lib/tslib
$ make
$ make Install
There are two different points:
One, there is no "Ac_cv_func_malloc_0_nonnull=yes", the compilation process did not error;
Second, remove the "–enable-inputapi=no", the online statement is not mentioned here, a single look at the Readme file Description:
Tslib_tsdevice TS device file name.
Default (non inputapi):/dev/touchscreen/ucb1x00
Default (INPUTAPI):/dev/input/event0
The touch screen device file of the board is/dev/input/event0 (the default, you can set this environment variable in the profile ts.conf).
After make install, 4 subdirectories are generated in the/home/latelee/lib/tslib directory:
Include Lib etc bin
The resulting library is located in Lib, which also has a subdirectory, TS, which contains many libraries for calibration (such as input.so, etc.). etc under the ts.conf is the configuration file, the bin directory for calibration, testing tools (such as calibrated ts_calibrate, Test ts_test).
The configuration file is as follows:
# late Lee 2011-03-31 for touchscreen test
Export Tslib_root=/usr/local/tslib
Export Tslib_tsdevice=/dev/input/event0
Export tslib_conffile= $TSLIB _root/etc/ts.conf
Export tslib_plugindir= $TSLIB _root/lib/ts
Export tslib_calibfile=/etc/pointercal
Export Tslib_consoledevice=none
Export tslib_fbdevice=/dev/fb0
Export ld_library_path= $LD _library_path: $TSLIB _root/lib
(the date of the document is the last day of last month, more than 10 days from now, and it will take a lot of time to spend it.) )
It is better to use tslib_root as long as the compiled generated Tslib folder is copied to a location, then the variable can be modified, and the others are not modified.
The configuration file ts.conf content is as follows:
Module_raw input
Module Pthres pmin=1
Module Variance delta=30
Module Dejitter delta=100
Module linear
There are many kinds of module_raw, which only use input (that is, the input subsystem of Linux, the device filename is called/dev/input/event0), and the others are deleted. The next few modules have not been well understood, they use the library in the Tslib/lib/ts, the last three blocks literally mean "variance (filter)", "Jitter (denoising)", "linear (coordinate transformation)", these things do not understand, do not express opinions.
Run the calibration program, the touch screen appears in turn 5 points, click on:
#./ts_calibrate
Xres = Yres = 320
Took samples ...
Top left:x = 276 Y = 795
Took-Samples ...
Top right:x = 736 Y = 796
Took samples ...
Bot right:x = 735 Y = 248
Took 7 Samples ...
Bot left:x = 274 Y = 247
Took 7 Samples ...
center:x = 505 Y = 524
-33.156189 0.304019-0.000832
369.119629 0.000871-0.401456
Calibration constants:-2172924 19924-54 24190624 57-26309 65536
The generated calibration file is named Pointercal, which is located in the/etc directory.
If you want to run the TS test program, enter it in the Tslib/bin directory
./ts_test
Can.
At the top of the screen, there are three buttons, "Drag", "Draw" and "Quit", which are the first, so the crosshairs will be there when you tap anywhere with a stylus.
Here is a small section of the message that clicks the Draw button and writes with the Touch pen:
1,302,603,922,.77,029:98 302 1
130,260,392,2.8,003:107 300 1
1,302,603,922,.81,528:118 297 1
1,302,603,922,.83,029:130 294 1
1,302,603,922,.84,529:143 290 1
1,302,603,922,.84,529:151 288 1
1,302,603,922,.87,517:168 284 0
The first column is the TIMEVAL structure of the two members: Tv_sec and Tv_usec, the middle two columns are x and y coordinates, and finally pressure, here can be understood as "touch event", 1 means the touch pen click on the (Touch) screen, 0 means the touch pen left the screen ( There are a lot of 1 is normal, because the pen does not leave the touch screen during writing-This is nonsense, please ignore it.
Click "Quit" on the screen or press CTRL + C to exit the program.
The path to install Tslib in the front is the host (also known as the development host, server, host), and the TSLIB environment variable is related to the Development Board (also known as the target Board, board, Target).
Finally, a picture of the picture has the truth:
This article fixed link: http://www.latelee.org/embedded-linux/porting-linux-tslib.html
Linux transplant Essay: Finally solve the problem of tslib "turn"