A touch driving implementation method compatible with multiple display screens and related products
By constructing global structures and global variables, parsing display information, and executing the touch driver initialization matching process, the compatibility issues of different LCD displays are resolved, achieving efficient and stable touch driver adaptation suitable for Android/Linux kernel systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOUSNGKE INFORMATION TECH
- Filing Date
- 2026-03-06
- Publication Date
- 2026-06-09
Smart Images

Figure CN122172989A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a touch driver implementation method compatible with multiple displays, a touch driver implementation device compatible with multiple displays, a corresponding electronic device, and a corresponding computer-readable storage medium. Background Technology
[0002] Currently, Android tablet manufacturers, considering factors such as supply chain risk control, cost optimization, and deepening technological cooperation, generally employ a supply strategy that uses multiple LCD (Liquid Crystal Display) suppliers for the same device. Different suppliers provide LCD displays with varying touch drivers, thus requiring compatibility adaptation for the touch drivers of multiple LCD displays.
[0003] Currently, the industry's touch driver compatibility technologies for this requirement mainly include two implementation methods: one is to achieve compatibility between different touch driver codes by detecting IDs. However, this method involves the handling logic of driver memory allocation and deallocation. If the relevant logic is not handled properly, it can easily cause kernel crashes. Moreover, when there are many touch drivers that need to be compatible, loading each driver one by one and performing ID detection will increase unnecessary system time. The other method is to distinguish the touch screens adapted to different displays by using the LCD name, thereby achieving touch driver compatibility. However, if this method relies on the upper layer to configure the LCD name, the process of obtaining this configuration information in the lower kernel is cumbersome, which will significantly increase the amount of code development and also has poor compatibility across different hardware platforms. Therefore, the aforementioned touch driver compatibility technologies cannot simply and quickly achieve compatibility between different touch drivers. Summary of the Invention
[0004] This application provides a touch driver implementation method and related products that are compatible with multiple displays, enabling simple and quick implementation of compatible touch drivers.
[0005] In one aspect, this application provides a touch driver implementation method compatible with multiple displays, the method comprising: Construct a global structure and define global variables for the global structure; the global variables are used for driving on different touch screens; Read the display fields of each display screen, parse the display fields to obtain the display screen information, and write the display screen information into the corresponding global variables of the global structure; the global variables include the touch screen connection status flag, the LCD ID string, and the touch IC (Integrated circuit) type; Based on the global variables, the initialization matching process of each touch driver is executed sequentially; The initialization matching process includes an initialization start phase, a touch IC firmware loading phase, and an initialization completion phase. In the initialization start phase, if the touchscreen connection status flag is 1, or if the touch IC type predefined by the current touch driver is inconsistent with the touch IC type in the global structure, the initialization process exits, and the next touch driver's initialization matching process begins. If the touchscreen connection status flag is 0, and the touch IC type predefined by the current touch driver is consistent with the touch IC type in the global structure, the initialization process executes normally. In the touch IC firmware loading phase, the firmware name is obtained by concatenating the touch driver name of the current touch driver and the LCD ID string. In the initialization completion phase, the touchscreen connection status flag in the global structure is set to 1, locking the matching result between the current touch driver and the currently used display screen. After all touch drivers have been matched, the successfully matched touch drivers will be kept running according to the matching results.
[0006] In some embodiments of this application, the display screen information includes an LCD ID string, a touch IC type, a touch screen ID, and a touch screen X / Y data exchange or flip flag; reading the display screen fields of each display screen and parsing the display screen fields to obtain the display screen information includes: The LCD ID field, passed to the kernel startup parameters, is read through the kernel function interface. The LCD ID field is then parsed to obtain the LCD ID string of the currently used display, the touch IC type, the touch screen ID, and the touch screen X / Y data exchange or flip flag.
[0007] In some embodiments of this application, the method further includes: Based on the display screen information, a character node is created and provided to the upper-layer application. The upper-layer application obtains the LCD ID string of the currently used display screen, the touch IC type, the touch driver matching status, and the touch screen X / Y data exchange or flip flag information by reading the character node.
[0008] In some embodiments of this application, the touchscreen X / Y data exchange or flip flag is used to calibrate the mapping relationship between touchscreen coordinates and display screen coordinates. Specifically, when the X / Y data exchange flag is 1, the X and Y axis coordinate data are exchanged; when the X / Y data exchange flag is 0, the X and Y axis coordinate data are not exchanged. When the X-axis flip flag is 1, the X-axis coordinate is processed in reverse; when the X-axis flip flag is 0, the X-axis coordinate is not flipped. When the Y-axis flip flag is 1, the Y-axis coordinate is processed in reverse; when the Y-axis flip flag is 0, the Y-axis coordinate is not flipped.
[0009] In some embodiments of this application, the method further includes: When calling the preset firmware interface, the firmware name is passed to a preset static global variable character array; the firmware name in the preset static global variable character array is used by the preset firmware interface to load the corresponding firmware.
[0010] In some embodiments of this application, the method further includes: For different touch driver codes, global variables of the global structure are added to the module initialization function of the corresponding touch driver module to execute the initialization matching process.
[0011] In some embodiments of this application, each touch driver module references a header file containing the global structure definition to call the global variables.
[0012] On the other hand, this application provides a touch driver implementation device compatible with multiple displays, the device comprising: A global structure construction module is used to construct a global structure and define global variables of the global structure; the global variables are used for driving on different touch screens. The global structure writing module is used to read the display fields of each display screen, parse the display fields to obtain display information, and write the display information into the corresponding global variables of the global structure; the global variables include touch screen connection status flags, LCD ID string, and touch IC type; The initialization matching module is used to execute the initialization matching process of each touch driver sequentially based on the global variables; after all touch drivers have completed matching, the successfully matched touch drivers are retained and run according to the matching results. The initialization matching module includes: The initialization start submodule is used to exit the initialization process and enter the initialization matching process of the next touch driver when the touch screen connection status flag is 1 or the touch IC type predefined by the current touch driver is inconsistent with the touch IC type in the global structure; when the touch screen connection status flag is 0 and the touch IC type predefined by the current touch driver is consistent with the touch IC type in the global structure, the initialization process is executed normally. The Touch IC Firmware Loading Submodule is used to concatenate the touch driver name of the current touch driver and the LCD ID string to obtain the firmware name; The initialization completion submodule is used to set the touch screen connection status flag in the global structure to 1, locking the matching result between the current touch driver and the currently used display screen.
[0013] In some embodiments of this application, the display screen information includes an LCD ID string, a touch IC type, a touch screen ID, and a touch screen X / Y data exchange or flip flag; the global structure writing module includes: The display information reading submodule is used to read the LCD ID field passed to the kernel startup parameters through the kernel function interface, and parse the LCD ID field to obtain the LCD ID string of the currently used display, the touch IC type, the touch screen ID, and the touch screen X / Y data exchange or flip flag.
[0014] In some embodiments of this application, the apparatus further includes: The character node creation module is used to create character nodes based on the display screen information and provide the character nodes to the upper layer application. The upper layer application obtains information such as the LCD ID string of the currently used display screen, the touch IC type, the touch driver matching status, and the touch screen X / Y data exchange or flip flag bit by reading the character nodes.
[0015] In some embodiments of this application, the touchscreen X / Y data exchange or flip flag is used to calibrate the mapping relationship between touchscreen coordinates and display screen coordinates. Specifically, when the X / Y data exchange flag is 1, the X and Y axis coordinate data are exchanged; when the X / Y data exchange flag is 0, the X and Y axis coordinate data are not exchanged. When the X-axis flip flag is 1, the X-axis coordinate is processed in reverse; when the X-axis flip flag is 0, the X-axis coordinate is not flipped. When the Y-axis flip flag is 1, the Y-axis coordinate is processed in reverse; when the Y-axis flip flag is 0, the Y-axis coordinate is not flipped.
[0016] In some embodiments of this application, the initialization matching module further includes; The firmware name is written to the submodule, which is used to pass the firmware name to a preset static global variable character array when calling the preset firmware interface; the firmware name in the preset static global variable character array is used for the preset firmware interface to load the corresponding firmware.
[0017] In some embodiments of this application, the initialization matching module further includes; Global variables are added to submodules to add global variables of the global structure to the module initialization function of the corresponding touch driver module for different touch driver code, so as to execute the initialization matching process.
[0018] In some embodiments of this application, each touch driver module references a header file containing the global structure definition to call the global variables.
[0019] In another aspect, this application also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements any of the touch driver implementation methods compatible with multiple displays as described above.
[0020] In another aspect, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements any of the touch driver implementation methods compatible with multiple displays as described above.
[0021] In another aspect, this application also provides a computer program product containing instructions that, when run on a computer, cause the computer to execute the touch driver implementation method compatible with multiple displays described in the above aspects.
[0022] This application provides a touch driver implementation method and related products compatible with multiple displays. By constructing a global structure and defining global variables within that structure, the defined global variables can be used for driving different touchscreens. The display fields of each display screen can be read, and the parsed display information is written into the global structure as corresponding global variables. Then, based on these global variables, the initialization matching process of each touch driver is executed sequentially. Specifically, the initialization matching process can include an initialization start stage, a touch IC loading stage, and an initialization completion stage. In the initialization start stage, if the touchscreen connection status flag is 1, or if the predefined touch IC type of the current touch driver is inconsistent with the touch IC type in the global structure, the initialization process can exit and proceed to the initialization matching process of the next touch driver. If the touchscreen connection status flag is 0, and the predefined touch IC type of the current touch driver is consistent with the touch IC type in the global structure, the initialization process is executed normally. In the touch IC loading stage, the touch driver name of the current touch driver and the LCD... The firmware name is obtained by concatenating the ID string. During the initialization completion phase, the touchscreen connection status flag in the global structure can be set to 1 to lock the matching result between the current touch driver and the currently used display. After all touch drivers have completed matching, the successfully matched touch drivers can be retained for operation. By constructing a global structure and determining the touch driver matching status by passing the touchscreen connection status flag, simple and quick compatibility with different touch drivers can be achieved. Furthermore, when it is necessary to load the touch IC firmware, the LCD ID is used as a component of the touch firmware name, and the firmware name is concatenated according to the driver name and LCD ID to ensure that firmware for different screens is not mixed. Attached Figure Description
[0023] Figure 1This is a flowchart illustrating the steps of a touch driver implementation method compatible with multiple displays, as provided in an embodiment of this application. Figure 2 This is a schematic diagram illustrating the process of initializing a global variable module according to an embodiment of this application; Figure 3 This is a schematic diagram illustrating the initialization process of a touch driver module according to an embodiment of this application; Figure 4 This is a structural block diagram of a touch driver implementation device compatible with multiple displays provided in an embodiment of this application; Figure 5 This is a structural block diagram of an electronic device provided in an embodiment of this application; Figure 6 This is a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. Detailed Implementation
[0024] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] This application's embodiments achieve efficient compatibility between different touch drivers by constructing a global structure and relying on flag bits to determine the touch driver matching status. Compared with existing technologies, it exhibits significant technical advantages in multiple dimensions: First, the solution is lightweight and flexible, with a small overall code size. Touch drivers can be loaded using build-in or ko module methods (only the driver corresponding to the global structure needs to be loaded first), and the driver code is independently decoupled, requiring only header file references for calling, significantly reducing development and maintenance costs. Second, it has outstanding cross-platform and cross-system adaptability, seamlessly portable to hardware platforms from different SOC (System-on-Chip) manufacturers, while also being compatible with Android and Linux systems, offering a wide range of compatibility. Third, performance and stability are significantly improved. By terminating the initialization process of mismatched drivers in advance through global flag bits, compared to the traditional ID-based compatibility detection method, it can significantly reduce touch driver matching time and avoid kernel crashes caused by improper memory operations, enhancing code robustness and security. Fourth, it has strong scalability, allowing expansion of the LCD. The ID bit is compatible with touchscreens with active pens, or new global structure members can be added to adapt to different sensor (a type of photosensitive device) types. It can also be compatible with different models of the same touch IC by using the type flag bit. Fifth, it has good monitorability. By providing character nodes for upper-layer applications to read, it can obtain key data such as the current display information and touch driver matching status in real time, which is convenient for debugging and status management.
[0026] The touch driver implementation method compatible with multiple displays provided in this application is applicable to Android / Linux kernel systems, and is mainly based on Android system / Linux kernel to achieve compatibility of different touch drivers.
[0027] Reference Figure 1 This document illustrates a flowchart of a touch driver implementation method compatible with multiple displays, provided by an embodiment of this application. The method may specifically include the following steps: Step S101: Construct a global structure and define global variables for the global structure.
[0028] The global structure is a globally visible structure that can be used by drivers on different touch screens. In other words, the global variables of the global structure can be called by all touch drivers and store key information such as screen identifier, matching status, and coordinate calibration in a unified manner.
[0029] Optionally, global variables (i.e. members of the global structure) can include touchscreen connection status flags, touch IC type, LCD ID string, touchscreen ID, touchscreen X / Y data exchange or flip flags, etc.
[0030] The touchscreen connection status flag can be used to indicate whether a touch driver has been successfully matched and initialized. It can serve as the core judgment basis for the subsequent initialization stage of the driver. If it is 0, the initialization continues; if it is 1, the driver exits directly, thereby avoiding the repeated loading of multiple drivers.
[0031] The touch IC type can be used to identify the touch IC model that is compatible with the current display. It can be used to match the driver type with the current screen IC type during subsequent driver initialization, thereby ensuring that the driver and IC model are consistent.
[0032] The LCD ID string can serve as a readable character-based unique identifier for the display screen. Its naming rules are consistent with the firmware name concatenation logic. It can be used to subsequently concatenate the touch IC firmware name and for upper-layer applications to read and identify the screen model, etc.
[0033] Touchscreen ID can serve as a unique numerical identifier for the display screen, supports bit extension, and enables fast logical judgment at the driver layer (high efficiency of numerical comparison) and extended compatibility with special functions such as active pens.
[0034] The touchscreen X / Y data exchange or flip flag can be further divided into three independent flags: X / Y exchange, X-axis flip, and Y-axis flip, and can be used in combination. It is primarily used to calibrate the mapping relationship between touchscreen coordinates and display coordinates, adapting to differences in the physical installation / design of different screens. Optionally, when the X / Y data exchange flag is 1, X and Y axis coordinate data can be exchanged; when the X / Y data exchange flag is 0, X and Y axis coordinate data are not exchanged. When the X-axis flip flag is 1, X-axis coordinates can be processed in reverse; when the X-axis flip flag is 0, X-axis coordinates are not flipped. Similarly, when the Y-axis flip flag is 1, Y-axis coordinates can be processed in reverse; when the Y-axis flip flag is 0, Y-axis coordinates are not flipped.
[0035] This application does not limit the scope of the embodiments.
[0036] Step S102: Read the display field of each display screen, parse the display field to obtain the display screen information, and write the display screen information into the corresponding global variable of the global structure.
[0037] In some embodiments of this application, the display screen may include a global variable module and a touch driver module. After each driver module of each display screen is loaded, the LCDID information defined by the currently used display screen can be obtained through the global variable module, and then the global variable can be used by the driver module to be compatible with different touch drivers.
[0038] In practical applications, key information about the currently used display screen can be read from the kernel boot parameters and stored in a global structure. Specifically, the display screen information is written into the corresponding global variables of the global structure.
[0039] Specifically, such as Figure 2 As shown, the LCD ID field passed to the kernel startup parameters can be read through the kernel function interface. The LCD ID field can be parsed to obtain display information such as the LCD ID string of the currently used display, the touch IC type, the touch screen ID, and the touch screen X / Y data exchange or flip flag.
[0040] Reference Figure 2 This diagram illustrates a process for initializing a global variable module according to an embodiment of this application. The initialization of the global variable module involves the initialization of variable members in the global structure. Specifically, it involves reading the LCD ID field from the boot parameters `bootargs` passed to the kernel via the kernel function interface, and obtaining the display information of the currently used display screen by parsing the LCD ID field.
[0041] In some embodiments of this application, such as Figure 2 As shown, character nodes can also be created based on display information and provided to upper-layer applications. Upper-layer applications can then obtain information such as the LCD ID string of the currently used display, touch IC type, touch driver matching status, and touchscreen X / Y data exchange or flip flag by reading the character nodes. This allows upper-layer applications to obtain key data such as current display information and touch driver matching status in real time, facilitating debugging and status management. Optionally, character node creation can be implemented through a registry-like approach. For example, the ` / sys / class / sk_global_val / sk_global_val` node can be created using `class_register` for upper-layer use. Specifically, the `sk_global_val` class is created using `class_create`, corresponding to the ` / sys / class / sk_global_val` directory, and an `sk_global_val` device is created based on this class, corresponding to the ` / sys / class / sk_global_val / sk_global_val` attribute node, thereby creating the device node. This embodiment of the application does not limit this approach.
[0042] In practical applications, such as Figure 2 As shown, if the display information of the currently used display screen has been parsed and obtained, or if a character node for use by the upper-layer application has been created based on the parsed display information, the global variable-driven initialization process exits; if the display information of the currently used display screen has not been parsed and no character node has been created based on the parsed display information, the global variable-driven initialization process is executed normally. This application embodiment does not impose any limitations on this.
[0043] Step S103: Execute the initialization matching process of each touch driver sequentially based on global variables.
[0044] When the touch driver module is loaded, the initialization matching process of each touch driver can be executed sequentially based on global variables.
[0045] The initialization matching process can include an initialization start phase, a touch IC firmware loading phase, and an initialization completion phase. Specifically, when different touch drivers are loaded, the decision to continue initialization can be determined by referencing a flag in the same global structure.
[0046] During the initialization phase, the global structure can be searched first, and global variable flags, such as touch screen connection status flags and touch IC type, can be referenced.
[0047] Optional, such as Figure 3 As shown, the initialization process can first be determined by checking if the touchscreen connection status flag is 1. In one case, if the touchscreen connection status flag is 1, it indicates that a driver has been successfully matched, and the initialization process can be exited directly. In another case, if the touch IC type predefined by the current touch driver is inconsistent with the touch IC type in the global structure, it indicates that the type of the currently used display screen does not match the type of the touch driver itself, and the initialization process can be exited, and the initialization matching process of the next touch driver can be entered. In yet another case, if the touchscreen connection status flag is 0, and the touch IC type predefined by the current touch driver is consistent with the touch IC type in the global structure, the initialization process will be executed normally.
[0048] During the touch IC firmware loading stage, the firmware name can be obtained by concatenating the touch driver name and LCD ID string of the current touch driver. In other words, the LCD ID can be used as a component of the touch firmware name. By combining the touch driver name and LCD ID string to obtain the firmware name, it is ensured that firmware for different screens is not mixed.
[0049] Optionally, the touch driver name and the LCD ID string can be concatenated using the sprintf function interface. The touch driver name can be customized according to different touch drivers, and this embodiment does not impose any restrictions on this.
[0050] In practical applications, the touch IC firmware loading stage is mainly used for drivers that dynamically load external firmware using a preset firmware interface (such as the request_firmware interface). Specifically, when calling the preset firmware interface (such as the request_firmware interface), the firmware name can be passed to a preset static global variable character array, which can then be used to store the concatenated firmware name.
[0051] The firmware name in the preset static global variable character array is mainly used by the preset firmware interface (such as the request_firmware interface) to load the corresponding firmware. It should be noted that the name of the touch firmware is the same as the string passed to the preset static global variable character array to ensure that the preset firmware interface can accurately load the corresponding firmware.
[0052] During the initialization completion phase, such as Figure 3 As shown, the touchscreen connection status flag in the global structure can be set to 1, locking the matching result between the current touch driver and the currently used display. Setting the touchscreen connection status flag to 1 indicates that the current touch driver and the currently used display have successfully matched. This allows other touch drivers to automatically exit initialization when they read that the flag is 1 during initialization matching, thus keeping only the uniquely matched touch driver running, achieving touch driver compatibility across multiple display types.
[0053] In some embodiments of this application, the touch driver can be loaded by compiling it into the kernel or dynamically loading it as a ko module, and it is necessary to ensure that the driver module corresponding to the global structure is loaded before other touch drivers.
[0054] In some embodiments of this application, each touch driver module can reference a header file containing global structure definitions, thereby enabling the calling of global variables, decoupling them from other driver code, and eliminating the need to modify the core logic. Specifically, for different touch driver code, global variables of the global structure can be added to the preset function defined in the corresponding touch driver module's module initialization function `module_init(xxx)` to execute, for example... Figure 3 The initialization and matching process shown enables seamless porting to hardware platforms from different SOC manufacturers.
[0055] In this embodiment, the initialization process of the mismatched driver is terminated in advance by using a global flag. Compared with the ID compatibility detection method of reading the touch IC product ID, this can reduce the time consumed by touch driver matching and avoid kernel crashes caused by improper memory allocation / release.
[0056] Step S104: After all touch drivers have completed matching, keep the successfully matched touch drivers running according to the matching results.
[0057] After all touch drivers have been matched, only the one successfully matched touch driver is kept running, thus achieving touch driver compatibility across multiple displays.
[0058] In this embodiment, a global structure is constructed and global variables are defined. These global variables can be used to drive different touchscreens. The display fields of each screen can be read, and the parsed display information is written into the global structure as corresponding global variables. Then, the initialization matching process of each touch driver is executed sequentially based on the global variables. Specifically, the initialization matching process can include an initialization start stage, a touch IC solid-state loading stage, and an initialization completion stage. In the initialization start stage, if the touchscreen connection status flag is 1, or the predefined touch IC type of the current touch driver is inconsistent with the touch IC type in the global structure, the initialization process can be exited, and the initialization matching process of the next touch driver can be entered. If the touchscreen connection status flag is 0, and the predefined touch IC type of the current touch driver is consistent with the touch IC type in the global structure, the initialization process is executed normally. In the touch IC solid-state loading stage, the firmware name can be obtained by concatenating the touch driver name of the current touch driver and the LCD ID string. In the initialization completion stage, the touchscreen connection status flag in the global structure can be set to 1 to lock the matching result between the current touch driver and the currently used display screen. After all touch drivers have completed matching, the successfully matched touch drivers are retained and run according to the matching results. By constructing a global structure and determining the touch driver matching status by passing the touch screen connection status flag, it is possible to achieve simple and quick compatibility with different touch drivers.
[0059] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of this application are not limited to the described order of actions, because according to the embodiments of this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of this application.
[0060] Reference Figure 4 This diagram illustrates a structural block diagram of a touch driver implementation device compatible with multiple displays, provided by an embodiment of this application. Specifically, it may include the following modules: The global structure construction module 401 is used to construct global structures and define global variables of the global structures; global variables are used for driving on different touch screens. The global structure writing module 402 is used to read the display fields of each display screen, parse the display fields to obtain the display information, and write the display information into the corresponding global variables of the global structure; the global variables include the touch screen connection status flag, the LCD ID string, and the touch IC type; The initialization matching module 403 is used to execute the initialization matching process of each touch driver in sequence based on global variables; after all touch drivers have completed matching, the successfully matched touch drivers are retained and run according to the matching results.
[0061] In some embodiments of this application, the initialization matching module 403 may include the following sub-modules; The initialization start submodule is used to exit the initialization process and enter the initialization matching process of the next touch driver when the touch screen connection status flag is 1 or the touch IC type predefined by the current touch driver is inconsistent with the touch IC type in the global structure; when the touch screen connection status flag is 0 and the touch IC type predefined by the current touch driver is consistent with the touch IC type in the global structure, the initialization process is executed normally. The Touch IC Firmware Loading Submodule is used to concatenate the touch driver name and LCD ID string of the current touch driver to obtain the firmware name; The initialization completion submodule is used to set the touch screen connection status flag in the global structure to 1, locking the matching result between the current touch driver and the currently used display.
[0062] In some embodiments of this application, the display information includes an LCD ID string, a touch IC type, a touch screen ID, and a touch screen X / Y data exchange or flip flag; the global structure writing module 402 may include the following sub-modules: The display information reading submodule is used to read the LCD ID field passed to the kernel startup parameters through the kernel function interface, and parse the LCD ID field to obtain the LCD ID string of the currently used display, the touch IC type, the touch screen ID, and the touch screen X / Y data exchange or flip flag.
[0063] In some embodiments of this application, the apparatus provided in this application may further include the following modules: The character node creation module is used to create character nodes based on display information and provide the character nodes to the upper-layer application. The upper-layer application obtains information such as the LCD ID string of the currently used display, touch IC type, touch driver matching status, and touch screen X / Y data exchange or flip flag by reading the character nodes.
[0064] In some embodiments of this application, the touchscreen X / Y data exchange or flip flag is used to calibrate the mapping relationship between touchscreen coordinates and display screen coordinates. Specifically, when the X / Y data exchange flag is 1, the X and Y axis coordinate data are exchanged; when the X / Y data exchange flag is 0, the X and Y axis coordinate data are not exchanged. When the X-axis flip flag is 1, the X-axis coordinate is processed in reverse; when the X-axis flip flag is 0, the X-axis coordinate is not flipped. When the Y-axis flip flag is 1, the Y-axis coordinate is processed in reverse; when the Y-axis flip flag is 0, the Y-axis coordinate is not flipped.
[0065] In some embodiments of this application, the initialization matching module 403 may further include the following sub-modules; The firmware name is written to the submodule and is used to pass the firmware name to the preset static global variable character array when calling the preset firmware interface; the firmware name in the preset static global variable character array is used for the preset firmware interface to load the corresponding firmware.
[0066] In some embodiments of this application, the initialization matching module 403 may further include the following sub-modules; Global variables are added to submodules to perform initialization matching processes by adding global variables of global structures to the module initialization function of the corresponding touch driver module for different touch driver code.
[0067] In some embodiments of this application, each touch driver module references a header file containing global structure definitions to call global variables.
[0068] In this embodiment, a global structure is constructed and global variables are defined. These global variables can be used to drive different touchscreens. The display fields of each screen can be read, and the parsed display information is written into the global structure as corresponding global variables. Then, the initialization matching process of each touch driver is executed sequentially based on the global variables. Specifically, the initialization matching process can include an initialization start stage, a touch IC solid-state loading stage, and an initialization completion stage. In the initialization start stage, if the touchscreen connection status flag is 1, or the predefined touch IC type of the current touch driver is inconsistent with the touch IC type in the global structure, the initialization process can be exited, and the initialization matching process of the next touch driver can be entered. If the touchscreen connection status flag is 0, and the predefined touch IC type of the current touch driver is consistent with the touch IC type in the global structure, the initialization process is executed normally. In the touch IC solid-state loading stage, the firmware name can be obtained by concatenating the touch driver name of the current touch driver and the LCD ID string. In the initialization completion stage, the touchscreen connection status flag in the global structure can be set to 1 to lock the matching result between the current touch driver and the currently used display screen. After all touch drivers have completed matching, the successfully matched touch drivers are retained and run according to the matching results. By constructing a global structure and determining the touch driver matching status by passing the touch screen connection status flag, it is possible to achieve simple and quick compatibility with different touch drivers.
[0069] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0070] This application also provides an electronic device, see embodiments thereof. Figure 5 The provided electronic device 500 includes a memory 510, a processor 520, and a computer program 511 stored in the memory 510 and capable of running on the processor 520. When the computer program 511 is executed by the processor, it implements the various processes of the above-described embodiment of the touch driver implementation method compatible with multiple displays and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0071] This application also provides a computer-readable storage medium, see embodiments thereof. Figure 6 The computer-readable storage medium 600 provided stores a computer program 511. When the computer program 511 is executed by the processor, it implements the various processes of the above-described embodiment of the touch driver implementation method compatible with multiple displays and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0072] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0073] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of the embodiments of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or modules is not necessarily limited to those steps or modules explicitly listed, but may include other steps or modules not explicitly listed or inherent to these processes, methods, products, or devices. The division of modules in the embodiments of this application is merely a logical division; in actual applications, there may be other division methods. For example, multiple modules may be combined into or integrated into another system, or some features may be ignored or not performed. Additionally, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interface, and the indirect coupling or communication connection between modules may be electrical or other similar forms, none of which are limited in the embodiments of this application. Furthermore, the modules or sub-modules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed among multiple circuit modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the embodiments of this application.
[0074] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0075] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and modules described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0076] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or modules through some interfaces, and may be electrical, mechanical, or other forms.
[0077] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0078] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated module can be implemented in hardware or as a software functional module. If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium.
[0079] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product.
[0080] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that integrates one or more available media. The available medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0081] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0082] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The functions specified in one or more boxes; these computer program instructions may also be loaded onto a computer or other programmable data processing terminal equipment to cause a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0083] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.
[0084] Finally, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0085] The technical solutions provided in the embodiments of this application have been described in detail above. Specific examples have been used in the embodiments of this application to illustrate the principles and implementation methods of the embodiments of this application. The description of the above embodiments is only for the purpose of helping to understand the methods and core ideas of the embodiments of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the embodiments of this application. Therefore, the content of this specification should not be construed as a limitation on the embodiments of this application.
Claims
1. A touch driver implementation method compatible with multiple display screens, characterized in that, The method includes: Construct a global structure and define global variables for the global structure; the global variables are used for driving on different touch screens; Read the display fields of each display screen, parse the display fields to obtain display screen information, and write the display screen information into the corresponding global variables of the global structure; the global variables include touch screen connection status flags, LCD ID string, and touch IC type; Based on the global variables, the initialization matching process of each touch driver is executed sequentially; The initialization matching process includes an initialization start phase, a touch IC firmware loading phase, and an initialization completion phase. In the initialization start phase, if the touchscreen connection status flag is 1, or if the touch IC type predefined by the current touch driver is inconsistent with the touch IC type in the global structure, the initialization process exits, and the next touch driver's initialization matching process begins. If the touchscreen connection status flag is 0, and the touch IC type predefined by the current touch driver is consistent with the touch IC type in the global structure, the initialization process executes normally. In the touch IC firmware loading phase, the firmware name is obtained by concatenating the touch driver name of the current touch driver and the LCD ID string. In the initialization completion phase, the touchscreen connection status flag in the global structure is set to 1, locking the matching result between the current touch driver and the currently used display screen. After all touch drivers have been matched, the successfully matched touch drivers will be kept running according to the matching results.
2. The method according to claim 1, characterized in that, The display screen information includes an LCD ID string, touch IC type, touch screen ID, and touch screen X / Y data exchange or flip flag; reading the display screen fields of each display screen and parsing the display screen fields to obtain the display screen information includes: The LCD ID field, passed to the kernel startup parameters, is read through the kernel function interface. The LCD ID field is then parsed to obtain the LCD ID string of the currently used display, the touch IC type, the touch screen ID, and the touch screen X / Y data exchange or flip flag.
3. The method according to claim 2, characterized in that, The method further includes: Based on the display screen information, a character node is created and provided to the upper-layer application. The upper-layer application obtains the LCD ID string of the currently used display screen, the touch IC type, the touch driver matching status, and the touch screen X / Y data exchange or flip flag information by reading the character node.
4. The method according to claim 2 or 3, characterized in that, The touchscreen X / Y data exchange or flip flag is used to calibrate the mapping relationship between touchscreen coordinates and display screen coordinates. When the X / Y data exchange flag is 1, the X and Y axis coordinate data are exchanged; when the X / Y data exchange flag is 0, the X and Y axis coordinate data are not exchanged. When the X-axis flip flag is 1, the X-axis coordinate is processed in reverse; when the X-axis flip flag is 0, the X-axis coordinate is not flipped. When the Y-axis flip flag is 1, the Y-axis coordinate is processed in reverse; when the Y-axis flip flag is 0, the Y-axis coordinate is not flipped.
5. The method according to claim 1, characterized in that, The method further includes: When calling the preset firmware interface, the firmware name is passed to a preset static global variable character array; the firmware name in the preset static global variable character array is used by the preset firmware interface to load the corresponding firmware.
6. The method according to claim 1, characterized in that, The method further includes: For different touch driver codes, global variables of the global structure are added to the module initialization function of the corresponding touch driver module to execute the initialization matching process.
7. The method according to claim 6, characterized in that, Each touch driver module references a header file containing the global structure definition to call the global variables.
8. A touch driver implementation device compatible with multiple display screens, characterized in that, The device includes: A global structure construction module is used to construct a global structure and define global variables of the global structure; the global variables are used for driving on different touch screens. The global structure writing module is used to read the display fields of each display screen, parse the display fields to obtain display information, and write the display information into the corresponding global variables of the global structure; the global variables include touch screen connection status flags, LCD ID string, and touch IC type; The initialization matching module is used to execute the initialization matching process of each touch driver sequentially based on the global variables; after all touch drivers have completed matching, the successfully matched touch drivers are retained and run according to the matching results. The initialization matching module includes: The initialization start submodule is used to exit the initialization process and enter the initialization matching process of the next touch driver when the touch screen connection status flag is 1 or the touch IC type predefined by the current touch driver is inconsistent with the touch IC type in the global structure; when the touch screen connection status flag is 0 and the touch IC type predefined by the current touch driver is consistent with the touch IC type in the global structure, the initialization process is executed normally. The Touch IC Firmware Loading Submodule is used to concatenate the touch driver name of the current touch driver and the LCD ID string to obtain the firmware name; The initialization completion submodule is used to set the touch screen connection status flag in the global structure to 1, locking the matching result between the current touch driver and the currently used display screen.
9. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the touch driver implementation method compatible with multiple displays as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the touch driver implementation method compatible with multiple displays as described in any one of claims 1 to 7.