Forlinx Posted October 23 Report Share Posted October 23 The touchscreen driver usually employs the input subsystem driver framework, so the application layer interface must adhere to the interfaces of the input framework. By entering ls -l /dev/input in the command line, you can see the current input devices available. root@freescale ~$ ls -l /dev/input/ total 0 crw - r----- 1 root root 13, 64 Jan 1 00:17 event0 crw - r----- 1 root root 13, 65 Jan 1 00:17 event1 crw - r----- 1 root root 13, 66 Jan 1 00:17 event2 crw - r----- 1 root root 13, 63 Jan 1 00:17 mice Lrwxrwxrwx 1 root root 6 Jan 1 00:18 ts0 -> event2 Lrwxrwxrwx 1 root root 6 Jan 1 00:18 ts2 -> event1 root@freescale ~$ View Touch Original Data When there is an issue with the touch function, you can determine whether the problem lies in the driver layer or the application layer by checking the raw data. There are several methods to view the raw data: 1. cat /dev/event2 Directly using cat on the touch event will output garbled characters when you touch the screen. 2. hexdump $ hexdump -d /dev/input/event0 0000000 15989 00000 18969 00004 00004 00004 00001 00009 # Other events 0000010 15989 00000 18969 00004 00001 00272 00001 00000 # BTN_MOUSE,press 0000020 15989 00000 18969 00004 00003 00000 16333 00000 # ABS_X 0000030 15989 00000 18969 00004 00003 00001 09599 00000 # ABS_Y 0000040 15989 00000 18969 00004 00000 00000 00000 00000 # Synchronous events 0000050 15989 00000 49415 00005 00004 00004 00001 00009 # Other events 0000060 15989 00000 49415 00005 00001 00272 00000 00000 # BTN_MOUSE,release 0000070 15989 00000 49415 00005 00000 00000 00000 00000 # Synchronous events The fourth, third, and second-to-last lines correspond to type, code, and value, which are all defined in linux/input.h. The event types for input devices in Linux are: #define EV_SYN 0x00 // Synchronous events #define EV_KEY 0x01 // Key events #define EV_REL 0x02 // Relative coordinates #define EV_REL 0x03 // Absolute coordinates #define EV_MSC 0x04 // Other events Type is the event type, where 3 is the EV _ ABS = 0x03 and 0 is the EV _ SYN = 0x00 (as a separator of events). The value of code depends on the event type. If the type is EV _ ABS, the value of code 0 is ABS _ X and the value of code 1 is ABS _ Y. Then, the value represents the measurement under the premises of type and code. For example, if the type is EV_ABS and the code is 0 (which corresponds to ABS_X), then the value represents the absolute X-axis position of the touch point. For example, if the type is EV_KEY, the code 272 corresponds to BTN_MOUSE, and code 330 corresponds to BTN_TOUCH; a value of 1 indicates a press, while a value of 0 indicates a release. For instance, if the type is EV_ABS and the code is 24 (which corresponds to ABS_PRESSURE), a value of 1 indicates that the screen is being pressed, while a value of 0 indicates it is released. The tests show that the coordinate values generated by the touchscreen touch events have a range of X: 016384 and Y: 09600, and this touchscreen does not upload ABS_PRESSURE. 3. ts_print / ts_print_raw The difference between the two is that ts _ print prints the data after tslib processing, while ts _ print _ raw prints the data before tslib processing. 4. evtest Evtest can not only print original, but it also allows you to see the event types. Driving Layer Processing Idea 1. Find the corresponding driver in the kernel source code by checking the device information. You can look for the corresponding string in the kernel source code; 2. To locate the touch reporting position, you can search for the string ABS in the corresponding driver. The image above shows the touch driver for a resistive screen. 3. Add print statements for further processing. Application Layer Processing 1. Use tools like ts_test to check if tslib is receiving data. 2. Change the version of tslib. Capacitive Screen In theory, capacitive screens do not require touch calibration; however, if they are not calibrated, there may be instances where the touch effects are opposite to the actual response, requiring the touch input to be inverted. However, if the reported data on the screen does not match the actual resolution, lower versions of Qt may not be able to handle it, necessitating manual calibration. Quote Link to comment Share on other sites More sharing options...
Beittlet Posted Friday at 06:44 AM Report Share Posted Friday at 06:44 AM On 10/23/2024 at 10:16 AM, Forlinx said: The touchscreen driver usually employs the input subsystem driver framework, so the application layer interface must adhere to the interfaces of the input framework. By entering ls -l /dev/input in the command line, you can see the current input devices available. root@freescale ~$ ls -l /dev/input/ total 0 crw - r----- 1 root root 13, 64 Jan 1 00:17 event0 crw - r----- 1 root root 13, 65 Jan 1 00:17 event1 crw - r----- 1 root root 13, 66 Jan 1 00:17 event2 crw - r----- 1 root root 13, 63 Jan 1 00:17 mice Lrwxrwxrwx 1 root root 6 Jan 1 00:18 ts0 -> event2 Lrwxrwxrwx 1 root root 6 Jan 1 00:18 ts2 -> event1 root@freescale ~$ View Touch Original Data When there is an issue with the touch function, you can determine whether the problem lies in the driver layer or the application layer by checking the raw data. There are several methods to view the raw data: 1. cat /dev/event2 Directly using cat on the touch event will output garbled characters when you touch the screen. 2. hexdump $ hexdump -d /dev/input/event0 0000000 15989 00000 18969 00004 00004 00004 00001 00009 # Other events 0000010 15989 00000 18969 00004 00001 00272 00001 00000 # BTN_MOUSE,press 0000020 15989 00000 18969 00004 00003 00000 16333 00000 # ABS_X 0000030 15989 00000 18969 00004 00003 00001 09599 00000 # ABS_Y 0000040 15989 00000 18969 00004 00000 00000 00000 00000 # Synchronous events 0000050 15989 00000 49415 00005 00004 00004 00001 00009 # Other events 0000060 15989 00000 49415 00005 00001 00272 00000 00000 # BTN_MOUSE,release 0000070 15989 00000 49415 00005 00000 00000 00000 00000 # Synchronous events The fourth, third, and second-to-last lines correspond to type, code, and value, which are all defined in linux/input.h. The event types for input devices in Linux are: #define EV_SYN 0x00 // Synchronous events #define EV_KEY 0x01 // Key events #define EV_REL 0x02 // Relative coordinates #define EV_REL 0x03 // Absolute coordinates #define EV_MSC 0x04 // Other events Type is the event type, where 3 is the EV _ ABS = 0x03 and 0 is the EV _ SYN = 0x00 (as a separator of events). The value of code depends on the event type. If the type is EV _ ABS, the value of code 0 is ABS _ X and the value of code 1 is ABS _ Y. Then, the value represents the measurement under the premises of type and code. For example, if the type is EV_ABS and the code is 0 (which corresponds to ABS_X), then the value represents the absolute X-axis position of the touch point. For example, if the type is EV_KEY, the code 272 corresponds to BTN_MOUSE, and code 330 corresponds to BTN_TOUCH; a value of 1 indicates a press, while a value of 0 indicates a release. For instance, if the type is EV_ABS and the code is 24 (which corresponds to ABS_PRESSURE), a value of 1 indicates that the screen is being pressed, while a value of 0 indicates it is released. The tests show that the coordinate values generated by the touchscreen touch events have a range of X: 016384 and Y: 09600, and this touchscreen does not upload ABS_PRESSURE. 3. ts_print / ts_print_raw The difference between the two is that ts _ print prints the data after tslib processing, while ts _ print _ raw prints the data before tslib processing. 4. evtest Evtest can not only print original, but it also allows you to see the event types. Driving Layer Processing Idea 1. Find the corresponding driver in the kernel source code by checking the device information. You can look for the corresponding string in the kernel source code; 2. To locate the touch reporting position, you can search for the string ABS in the corresponding driver. The image above shows the touch driver for a resistive screen. 3. Add print statements for further processing. Application Layer Processing 1. Use tools like ts_test to check if tslib is receiving data. 2. Change the version of tslib. Capacitive Screen In theory, capacitive screens do not require touch calibration; however, if they are not calibrated, there may be instances where the touch effects are opposite to the actual response, requiring the touch input to be inverted. However, if the reported data on the screen does not match the actual resolution, lower versions of Qt may not be able to handle it, necessitating manual calibration. basket random I appreciated was the emphasis on adhering to the interfaces of the input framework, which ensures compatibility and stability. The practical tips for calibration and adjustment are also valuable for anyone working with the iMX6ULL platform. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.