Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Experimental Test of Capacitance Touch screen under Linux

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "Experimental Test of Capacitance Touch screen under Linux". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

54.4 run the test

54.4.1 compile driver

To create a Makefile file, the content is basically the same as in the previous experiment. You need to change the value of obj-m to ft5426.o, as shown below:

KERNELDIR: = / home/topeet/kernel/linux-imx-rel_imx_4.1.15_2.1.0_ga

CURRENT_PATH: = $(shell pwd)

Obj-m: = ft5426.o

Build: kernel_modules

Kernel_modules:

$(MAKE)-C $(KERNELDIR) masking $(CURRENT_PATH) modules

Clean:

$(MAKE)-C $(KERNELDIR) masking $(CURRENT_PATH) clean

First, we enter two commands on the terminal (set two environment variables):

Export ARCH=arm

Export CROSS_COMPILE=arm-linux-gnueabihf-

Then execute the "make" command to compile and complete the production ft5426.ko driver module file.

54.4.2 run the test

Compile the device tree file, start the development board with the new device tree file, and then copy the compiled ft5426.ko driver module file to the development board root file system lib/modules/4.1.15 directory (check the development board root file system for "/ lib/modules/4.1.15" this directory, if not, you need to create it yourself. The busybox file system provided in the CD material is used in the development board, which is under the directory of "i.MX6UL Terminator CD material\ 08_ Development Board system Image\ 03file system Image\ 01_Busybox File system"). Make

Load the module with the following command:

Depmod

Modprobe ft5426

When the driver module is loaded successfully, the message is shown in figure 54.4.2.1:

The / dev/input/eventn device file will be generated after the driver is loaded successfully. For example, the touchscreen is shown in figure 54.4.2.2:

The event4 device file is the file corresponding to the touchscreen. Of course, it is also possible that the file name is different.

Use the command to view the event4 file:

Hexdump / dev/input/event4

When you touch the screen with one finger, you will get information output, as shown in figure 54.4.2.3:

54.4.3 add drivers to the kernel

Previously, we compiled the touchscreen driver into a module file, and the driver module needs to be loaded manually after each system boot, which is very inconvenient. When our device driver is debugged successfully, we usually compile the driver directly into the kernel, so that the driver will be loaded automatically after the kernel starts. In this section, let's take a look at how to add ft5426.c driver files to the Linux kernel.

1. Put the driver file in the appropriate directory

First of all, the driver files successfully tested must be placed in the appropriate directory of the Linux kernel. At this time, we can refer to the driver files of similar devices, such as touchscreen driver files, and we can find the driver files that are all about touch in the drivers/input/touchscreen directory, so we put the ft5426.c driver files in this directory.

2. Modify the corresponding Makefile of

After placing the ft5426.c driver file in the drivers/input/touchscreen directory, you need to modify the Makefile file in this directory by adding the following:

Obj-y + = ft5426.o

Add as shown:

After the modification is completed, recompile the Linux kernel, and then use the new zImage image to start the development board. The driver is added and started successfully, as shown in figure 54.4.3.2.

You can view the corresponding event time using the following command:

Cat / proc/bus/input/devices

The results are as follows:

You can see the / dev/input/event1 device file corresponding to ft5426, and then use the following command to see if the driver is working properly:

Hexdump / dev/input/event1

The result is shown in figure 54.4.3.4:

This indicates that the ft5426 driver is working properly.

This is the end of the content of "Experimental Test of Capacitance Touch screen under Linux". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report