Tslib Introduction and Transplant notes

Source: Internet
Author: User
Tags data structures touch

Tslib Introduction:

In the use of touch screen mobile terminals, touch screen performance debugging is one of the important issues, because of electromagnetic noise, touch screen is prone to inaccurate clicks, jitter and so on. Tslib is an open source program that can provide such functions as filtering, dithering, and calibration for touch-screen driven sampling, usually as a touch-screen-driven adaptation layer, providing a unified interface for upper-level applications.

Tslib more accurate principle:

In Qtopia, the touch screen debugging problem mainly involves the following three parts: Touch screen driver, Tslib,

Qtslibtpanelhandlerprivate package.

Touch-screen driver for the direct contact with the hardware part of the upper Tslib to provide the most original equipment coordinate data, and can configure the sampling interval, screen sensitivity and so on. The sampling interval determines the number of samples per unit time, in the case of other parameters unchanged, the smaller the sampling interval means that the number of samples per unit of time, it means that the more realistic sampling, the more difficult to see the sampling information loss such as input method when writing lost strokes, but because of the impact of noise, The smaller the sampling interval also means the less effective the displayed graphics are.

Tslib for the touch screen driver and the adaptation layer between the application layer, from the drive to obtain the original equipment coordinate data, through a series of denoising, shaking, coordinate transformation and other operations, to remove the noise and the original equipment coordinates into the corresponding screen coordinates.

The Tslib provides 2 main interfaces for the application layer Ts_read () and Ts_read_raw (), where Ts_read () is the normal case, Ts_read_raw () is the interface for calibration.

Normally, the general process of tslib the device coordinates that drives the sampling is as follows:

Raw device--> Variance--> dejitter--> linear--> Application

Module, module module

In the case of calibration, the general process of processing the data driven by the Tslib is as follows:

Raw device--> Calibrate

Qtslibtpanelhandlerprivate provides an application layer package for Tslib, which is the interface part of the Tslib and application layer.

In the process of touch screen debugging, the main parameters involved are sampling interval (drive), sensitivity (drive), denoising algorithm and constraint (tslib), chattering algorithm and constraint (tslib), TS Threshold (tslib).

Due to the impact of various related periods, the relevant parameters may need to be adjusted on different hardware platforms. The correlation of the above parameters is: the larger the sampling interval, the less the sampling point, the more distorted the sample, but because the information is less, easy to lose a stroke, such as loss, but the graphic effect will be better; denoising algorithm and sampling interval should be closely interactive, the larger the sampling interval, the less noise constraint should be smaller, conversely, the smaller the sampling interval, The greater the need to restrain noise. The chattering algorithm is a relatively independent part, the more complex the chattering algorithm, the resulting calculation will be larger, the system load will be heavier, but a good dither algorithm can better remove jitter, in the drawing will be better results; sensitivity and TS thresholds are sensitive indicators of touch screen, generally do not need to be changed, Reference reference value can be

Two structures are defined in the Tslib:

struct Tsdev {

int FD;

struct Tslib_module_info *list;

};

struct Ts_sample {

int x;

int y;

unsigned int pressure;

struct Timeval TV;

};

struct Tsdev is a touchscreen device, in which FD is the file descriptor for the touchscreen device that is open, and the list is a linked list in which the pointer to the Tslib plug-in is stored sequentially. struct ts_sample is used to hold key messages, X and y to indicate the coordinates of the key, note that these two coordinates are based on the LCD screen coordinate system, pressure is the severity of the key, the TV is a struct timeval type of variable, Indicates when the key occurred. In a tslib program, there are only two data structures to use.

Tslib Transplant:

Download source, I use here is tslib-1.4.tar.gz

1. #cd tslib-1.4

2, configure it to generate makefile files

#./configure--HOST=ARM-LINUX-GCC--prefix= (own installation directory)--enable-debug=no

3. Compile and install #make & make Install

4. If you want to run the test program, you need to configure the following parameters:

Export Tslib_plugindir=/lib/ts

Export tslib_fbdevice=/dev/fb0

Export tslib_tsdevice=/dev/input/event1//this is important.

Mkdir/data

Touch/data/pointercal

5. If the configuration command is written to Ts.config, to be placed before module Pthres pmin=1

Otherwise, a segmentation fault error will occur when you run the test program, and you cannot have spaces before each setting option

6. Run Ts_calibrate for calibration

7. Run Ts_test test program.

So everything is OK, the next step into our touch screen tour ...

This article is from the "Late Evening" blog, please be sure to keep this source http://yiluohuanghun.blog.51cto.com/3407300/837248

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.