1. First download tslib-1.4.tar.gz from the Internet
2. Decompress tar xvzf tslib-1.4.tar.gz; CD tslib
3. Generate configure, which is less than a general open-source project. Run the script in the decompressed directory first.
./Autogen. Sh
4. Use configure to generate makefile.
Generate scripts
./Configure -- Host = arm-Linux -- prefix =/home/SMB/tslib ac_cv_func_malloc_0_nonnull = yes -- enable-inputapi = No
Ac_cv_func_malloc_0_nonnull = yes is set to solve the following compilation errors:
Ts_test.o: In function 'main ': Ts_test.c :(. Text + 0x1d8): Undefined reference to 'rpl _ malloc' Fbutils. O: In function 'open _ framebuffer ': Fbutils. c :(. Text + 0xa20): Undefined reference to 'rpl _ malloc' Collect2: LD returned 1 exit status |
-- Enable-inputapi = No. is used to solve the running prompt ts_open: Inappropriate ioctol for device, which indicates
That is, do not use IOCTL to control the touch screen. However, I didn't see the prompt -- enable-inputapi = No
5. Compile and install
Make
Make install-Strip # library after installing strip
# Make install # The Strip library version is not installed.
After installation, copy the installation MYT to/usr/local/in the root file system/
Copy the ts_calibrate file written in/usr/local/tslib/bin/to/usr/bin.
Configure and test tslib
Tslib is only an application-level library. It is only used to encapsulate the underlying touch screen driver operations and is used by other applications with a unified interface. therefore, the premise for tslib to work properly is that the touch screen driver on the Development Board can work properly. in addition, the effects of the touch screen often need to be displayed on the LCD, so tslib also needs the framebuffer driver on the Development Board to work properly.
Arm Development Board common touch screen drivers are divided into two categories, one is to simulate the call interface of HP 3600, this type of drivers generally use/dev/h3600_tsraw device node files, early development boards are generally this type,
Another type is the driver that uses the Linux 2.6 input device interface. These drivers design touch screen drivers into a standard input event device (Linux input layer event interface ), the device node for all event input is/dev/input/eventn (n> = 0 ).
It is usually/dev/input/event0. the driver sends a standard struct event structure to the application.
Which driver interface is used by the arm board? refer to the manufacturer's documentation or directly view which driver is used by a successful program.
When running tslib, a key ts. conf is required to set which driver to use. You also need to set some environment variables. After tslib is compiled and installed, there is a TS. conf Template under the etc directory. If the h3600 device is used, module_raw h3600 is used. If the input device is used, module_raw input is used.
# Ts. conf Template Module_raw Input # Module_raw h3600 Module pthres pmin = 1 Module variance Delta = 30 Module dejitter Delta = 100 Module linear |
Note that the configuration item should be written in the top level. If there is space, tslib will have a U segment error. This is a bug.
To run tslib normally, you also need to configure a series of environment variables.
Export tslib_root =/usr/local/tslib # Export tslib_root =/mnt/hxy/output/arm_linux # Depends on the specific device driver. Export tslib_tsdevice =/dev/input/event0 # Use the following configurations for h3600: # Export tslib_tsdevice =/dev/h3600_tsraw # Locate the file storage location on the touch screen Export tslib_calibfile =/etc/pointercal # Tslib Configuration File Content Export tslib_conffile = $ tslib_root/etc/ts. conf # Tslib plug-in Directory Export tslib_plugindir = $ tslib_root/lib/TS Export tslib_consoledevice = none # LCD device Node Export tslib_fbdevice =/dev/fb0 # Add libts. So to the dynamic search path Export LD_LIBRARY_PATH = $ LD_LIBRARY_PATH: $ tslib_root/lib # Changing the font size export qws_display = "linuxfb: mmwidth35: mmheight45: 0" |
Put it in the flash or NFS Path developed by arm. You can test and run the bin test programs in the installation directory.
Run ts_test. The following interface is displayed on the screen. Click the console and the output will be displayed.
Touch screen positioning
The software usually uses the coordinate system of the mouse, which uses relative displacement to determine the position, but the touch screen uses absolute positioning coordinates. In order for the program to respond to touch screen clicks, the touch screen coordinates should be converted into the relative coordinates recognized by the software. Therefore, there must be a set of parameters for conversion. The conversion parameters are from the touch screen positioning program. If the parameters are incorrect, the most obvious result is inaccurate positioning. Every embedded device that uses a touch screen usually has such a tool, for example, we use a mobile phone. (However, positioning parameters for mass production are all set in a unified manner ).
The Development Board usually needs to be set manually. tslib comes with a ts_calibrate function. Qtopia also comes with one. The two interfaces are similar. The written results are usually in the/etc/pointercal text file.
The operation method is similar. When a small cross is displayed on the interface, click the intersection. The settings will show five small cross S in sequence in the upper left, lower left, upper right, lower right, and center.
Qtopia positioning program interface.
Location program interface of tslib
Install tslib
For the tslib release, libts. So and its plug-ins for various touch screen devices, ts. c