Virtual input method and terminal based on Linux

By adopting a Linux-based virtual input method in HMI devices and using virtual device files and backlight status to filter input events, the problem of misoperation of HMI devices when the screen is turned off or the touch panel fails is solved, achieving safer and more reliable operations. .

CN119336177APending Publication Date: 2025-01-21FUZHOU WECON ELECTRONICS TECH
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411320871.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-23
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

Existing HMI devices can easily lead to misoperation when the screen is turned off or the touch panel fails, and cannot be effectively avoided.

Method used

Adopting a linux -based virtual input method, by creating the character device files of the virtual device corresponding to the HMI device, read the input event coordinates of the physical touch node of the HMI device, and obtain the backlight state. If the backlight state is Changli, write a virtual device file; if it is out of the state, light up the backlight and ignore the input event coordinates to avoid error operation.

Benefits of technology

Effectively avoid the misunderstanding of HMI equipment, ensure selective filtering input events under specific conditions, and improve the operational safety and reliability of the equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336177A_ABST
    Figure CN119336177A_ABST
Patent Text Reader

Abstract

The invention discloses a Linux-based virtual input method and terminal, and the method comprises the steps: creating a character device file of a virtual device corresponding to an HMI device by using a Linux kernel, reading an input event coordinate of a physical touch node of the HMI device, obtaining a backlight state of the HMI device, and if the backlight state is a normally-on state, executing the operation of the HMI device; if the backlight state is an off state, it is indicated that the current input event is the real operation of the user on the HMI device, the coordinates of the input event are written into the character device file of the virtual device, and if the backlight state is an off state, it is indicated that the current input event is only the user wants to light the screen, and a system interface is called to light the backlight. According to the method, the input event coordinate is not written into the character device file of the virtual device, and the button operation corresponding to the coordinate is ignored, so that the input event is selectively filtered by using the character device file of the virtual device according to specific conditions, and misoperation of the HMI device is effectively avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of virtual input, and in particular to a virtual input method and terminal based on Linux. Background Art

[0002] In the prior art, when the screen of an HMI (Human Machine Interface) device is off, a user who touches the device screen to light up the screen often accidentally touches an important button, resulting in an erroneous operation. In addition, when the touch panel of the on-site HMI device fails, it can no longer be used to perform any operation. Summary of the invention

[0003] The technical problem to be solved by the present invention is to provide a Linux-based virtual input method and terminal, which can effectively avoid misoperation of HMI equipment.

[0004] In order to solve the above technical problems, the technical solution adopted by the present invention is:

[0005] A virtual input method based on Linux, comprising the steps of:

[0006] Use the Linux kernel to create a character device file for the virtual device corresponding to the HMI device;

[0007] Reading the input event coordinates of the physical touch node of the HMI device, and obtaining the backlight status of the HMI device;

[0008] If the backlight state is a constant light state, writing the input event coordinates into the character device file of the virtual device;

[0009] If the backlight state is off, the system interface is called to light up the backlight, and the input event coordinates are not written into the character device file of the virtual device.

[0010] In order to solve the above technical problems, another technical solution adopted by the present invention is:

[0011] A Linux-based virtual input terminal includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:

[0012] Use the Linux kernel to create a character device file for the virtual device corresponding to the HMI device;

[0013] Reading the input event coordinates of the physical touch node of the HMI device, and obtaining the backlight status of the HMI device;

[0014] If the backlight state is a constant light state, writing the input event coordinates into the character device file of the virtual device;

[0015] If the backlight state is off, the system interface is called to light up the backlight, and the input event coordinates are not written into the character device file of the virtual device.

[0016] The beneficial effects of the present invention are as follows: a character device file of a virtual device corresponding to an HMI device is created by using a Linux kernel, the input event coordinates of a physical touch node of the HMI device are read, and the backlight state of the HMI device is obtained; if the backlight state is a constantly on state, it indicates that the current input event is a real operation of the user on the HMI device, and the input event coordinates are written into the character device file of the virtual device; if the backlight state is an off state, it indicates that the current input event is just that the user wants to light up the screen, and the system interface is called to light up the backlight, and the input event coordinates are not written into the character device file of the virtual device, and the button operation corresponding to the coordinates is ignored, so that the character device file of the virtual device is used to selectively filter the input event according to specific conditions, thereby effectively avoiding the misoperation of the HMI device. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 A flowchart of a virtual input method based on Linux according to an embodiment of the present invention;

[0018] Figure 2 The figure is a schematic diagram of the structure of a Linux-based virtual input terminal according to an embodiment of the present invention. DETAILED DESCRIPTION

[0019] In order to explain the technical content, achieved objectives and effects of the present invention in detail, the following is an explanation in combination with the implementation modes and the accompanying drawings.

[0020] Please refer to Figure 1 , a virtual input method based on Linux, comprising the steps of:

[0021] Use the Linux kernel to create a character device file for the virtual device corresponding to the HMI device;

[0022] Reading the input event coordinates of the physical touch node of the HMI device, and obtaining the backlight status of the HMI device;

[0023] If the backlight state is a constant light state, writing the input event coordinates into the character device file of the virtual device;

[0024] If the backlight state is off, the system interface is called to light up the backlight, and the input event coordinates are not written into the character device file of the virtual device.

[0025] From the above description, it can be seen that the beneficial effect of the present invention is: using the Linux kernel to create a character device file of a virtual device corresponding to the HMI device, reading the input event coordinates of the physical touch node of the HMI device, and obtaining the backlight state of the HMI device. If the backlight state is always on, it means that the current input event is a real operation of the user on the HMI device, and the input event coordinates are written into the character device file of the virtual device. If the backlight state is off, it means that the current input event is just that the user wants to light up the screen, and the system interface is called to light up the backlight, and the input event coordinates are not written into the character device file of the virtual device, and the button operation corresponding to the coordinates is ignored, so that the character device file of the virtual device is used to selectively filter the input event according to specific conditions, thereby effectively avoiding the misoperation of the HMI device.

[0026] Furthermore, it also includes:

[0027] Monitor a custom data frame of simulated touch, wherein the custom data frame includes a coordinate position and an operation status;

[0028] The coordinate position and the operation status are written into the character device file of the virtual device.

[0029] From the above description, it can be known that by monitoring the custom data frame of simulated touch, the coordinate position and operation status therein are written into the character device file of the virtual device. In this way, when the touch panel of the on-site HMI device fails, the custom data frame of simulated touch can be used to realize virtual input, operate the HMI device normally, and can also be used for automatic testing of the HMI device.

[0030] Further, the step of writing the input event coordinates into the character device file of the virtual device comprises:

[0031] Performing five-point correction on the input event coordinates to obtain corrected input event coordinates;

[0032] The corrected input event coordinates are written into the character device file of the virtual device.

[0033] From the above description, it can be seen that the input event coordinates are the physical coordinates on the touch panel of the HMI device. A five-point correction is performed on them. The corrected input event coordinates are logical coordinates. The corrected input event coordinates are written into the character device file of the virtual device, thereby achieving more accurate virtual input.

[0034] Furthermore, the use of the Linux kernel to create a character device file of a virtual device corresponding to the HMI device includes:

[0035] Obtain the name of the HMI device and a table of registered physical device names;

[0036] It is determined whether the name of the HMI device exists in the registered physical device name table. If so, a character device file of a virtual device corresponding to the HMI device is created using the Linux kernel.

[0037] From the above description, it can be known that it is determined whether the name of the HMI device exists in the registered physical device name table. If so, it means that the HMI device is an adapted and supported physical device and can be associated with a virtual device. Then, the Linux kernel is used to create a character device file of the virtual device corresponding to the HMI device. When different customers perform secondary development on the same device system, there is no need to repeatedly develop adaptation.

[0038] Furthermore, the custom data frame for monitoring simulated touch includes:

[0039] A data frame is received, and it is determined whether the data frame is a custom data frame for simulating touch according to a frame header of the data frame. If so, a frame check is performed on the custom data frame for simulating touch. If the frame check is successful, the coordinate position and the operation status are written into the character device file of the virtual device.

[0040] From the above description, it can be known that whether the data frame is a custom data frame for simulated touch is determined according to the frame header of the data frame. If so, a frame check is performed on the custom data frame for simulated touch. If the frame check is successful, subsequent writing steps are executed to ensure the reliability of virtual input.

[0041] Please refer to Figure 2 , a virtual input terminal based on Linux, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0042] Use the Linux kernel to create a character device file for the virtual device corresponding to the HMI device;

[0043] Reading the input event coordinates of the physical touch node of the HMI device, and obtaining the backlight status of the HMI device;

[0044] If the backlight state is a constant light state, writing the input event coordinates into the character device file of the virtual device;

[0045] If the backlight state is off, the system interface is called to light up the backlight, and the input event coordinates are not written into the character device file of the virtual device.

[0046] From the above description, it can be seen that the beneficial effect of the present invention is: using the Linux kernel to create a character device file of a virtual device corresponding to the HMI device, reading the input event coordinates of the physical touch node of the HMI device, and obtaining the backlight state of the HMI device. If the backlight state is always on, it means that the current input event is a real operation of the user on the HMI device, and the input event coordinates are written into the character device file of the virtual device. If the backlight state is off, it means that the current input event is just that the user wants to light up the screen, and the system interface is called to light up the backlight, and the input event coordinates are not written into the character device file of the virtual device, and the button operation corresponding to the coordinates is ignored, so that the character device file of the virtual device is used to selectively filter the input event according to specific conditions, thereby effectively avoiding the misoperation of the HMI device.

[0047] Furthermore, it also includes:

[0048] Monitor a custom data frame of simulated touch, wherein the custom data frame includes a coordinate position and an operation status;

[0049] The coordinate position and the operation status are written into the character device file of the virtual device.

[0050] From the above description, it can be known that by monitoring the custom data frame of simulated touch, the coordinate position and operation status therein are written into the character device file of the virtual device. In this way, when the touch panel of the on-site HMI device fails, the custom data frame of simulated touch can be used to realize virtual input, operate the HMI device normally, and can also be used for automatic testing of the HMI device.

[0051] Further, the step of writing the input event coordinates into the character device file of the virtual device comprises:

[0052] Performing five-point correction on the input event coordinates to obtain corrected input event coordinates;

[0053] The corrected input event coordinates are written into the character device file of the virtual device.

[0054] From the above description, it can be seen that the input event coordinates are the physical coordinates on the touch panel of the HMI device. A five-point correction is performed on them. The corrected input event coordinates are logical coordinates. The corrected input event coordinates are written into the character device file of the virtual device, thereby achieving more accurate virtual input.

[0055] Furthermore, the use of the Linux kernel to create a character device file of a virtual device corresponding to the HMI device includes:

[0056] Obtain the name of the HMI device and a table of registered physical device names;

[0057] It is determined whether the name of the HMI device exists in the registered physical device name table. If so, a character device file of a virtual device corresponding to the HMI device is created using the Linux kernel.

[0058] From the above description, it can be known that it is determined whether the name of the HMI device exists in the registered physical device name table. If so, it means that the HMI device is an adapted and supported physical device and can be associated with a virtual device. Then, the Linux kernel is used to create a character device file of the virtual device corresponding to the HMI device. When different customers perform secondary development on the same device system, there is no need to repeatedly develop adaptation.

[0059] Furthermore, the custom data frame for monitoring simulated touch includes:

[0060] A data frame is received, and it is determined whether the data frame is a custom data frame for simulating touch according to a frame header of the data frame. If so, a frame check is performed on the custom data frame for simulating touch. If the frame check is successful, the coordinate position and the operation status are written into the character device file of the virtual device.

[0061] From the above description, it can be known that whether the data frame is a custom data frame for simulated touch is determined according to the frame header of the data frame. If so, a frame check is performed on the custom data frame for simulated touch. If the frame check is successful, subsequent writing steps are executed to ensure the reliability of virtual input.

[0062] The Linux-based virtual input method and terminal of the present invention can be applied to HMI devices, and are described below through specific implementation methods:

[0063] Please refer to Figure 1 , Embodiment 1 of the present invention is:

[0064] A virtual input method based on Linux, comprising the steps of:

[0065] S1. Use the Linux kernel to create a character device file for the virtual device corresponding to the HMI device, including S11-S12:

[0066] S11,

[0067] Obtain the name of the HMI device and a table of registered physical device names.

[0068] When the device is powered on, an independent service process is started and run. In this service process, / proc / bus / input / devices is read to obtain the name of the HMI device and the registered physical device name table. The registered physical device name table pre-stores the physical devices that have been adapted and supported.

[0069] S12, determining whether the name of the HMI device exists in the registered physical device name table, and if so, using the Linux kernel to create a character device file of a virtual device corresponding to the HMI device.

[0070] If the name of the HMI device exists in the table of registered physical device names, it means that the HMI device can be associated with the virtual device. The character device file of the virtual device corresponding to the HMI device is created using the Linux kernel, specifically:

[0071] Use Linux kernel uinput to create a character device file / dev / input / event of the virtual device corresponding to the HMI device, such as TSLIB_TSDEVICE = / dev / input / event2, QT_QPA_GENERIC_PLUGINS = TSLIB: / dev / input / event2, that is, the environment variable specifies that the source of the touch event obtained by the application is / dev / input / event2, that is, the virtual device, not the physical device. Therefore, only the touch events written to the character device file of the virtual device can reach the application.

[0072] S2. Read the input event coordinates of the physical touch node of the HMI device, and obtain the backlight status of the HMI device.

[0073] The input event is a touch event.

[0074] S3. If the backlight state is always on, writing the input event coordinates into the character device file of the virtual device, specifically including S31-S32:

[0075] S31, if the backlight state is always on, perform five-point correction on the input event coordinates to obtain the corrected input event coordinates, specifically:

[0076] x = (aX + bY + c) / s;

[0077] y=(fY+eX+g) / s;

[0078] In the formula, x represents the horizontal coordinate in the corrected input event coordinates, y represents the vertical coordinate in the corrected input event coordinates, X represents the horizontal coordinate in the input event coordinates, Y represents the vertical coordinate in the input event coordinates, and a, b, c, e, f, g, and s represent the calibration data generated from the tslib calibration file pointercal (data file for touch screen calibration). Among them, the input event coordinates are physical coordinates, and the corrected input event coordinates are logical coordinates.

[0079] S32: Write the corrected input event coordinates into the character device file of the virtual device.

[0080] S4. If the backlight state is off, the system interface is called to light up the backlight, and the input event coordinates are not written into the character device file of the virtual device.

[0081] Because the coordinate information obtained by the application layer specified by the environment variable is executed by the virtual device node, the values ​​read from the physical device are not written to the virtual device node, and these coordinates cannot reach the application, thus achieving the effect of ignoring the touch operation.

[0082] In the prior art, when the backlight is off, the user wants to light up the screen of the HMI device so he touches the screen. At this time, if a button is clicked, the touch operation will also be processed, resulting in an erroneous operation. However, the present invention uses the character device file of the virtual device to select whether to write the input event coordinates into it according to the backlight state, so that the user's touch operation can be filtered out when the backlight is off, thereby avoiding erroneous operations.

[0083] S5. Monitor a custom data frame of simulated touch, where the custom data frame includes a coordinate position and an operation status.

[0084] Specifically, a data frame is received, and it is determined whether the data frame is a custom data frame for simulating touch according to a frame header of the data frame. If so, a frame check is performed on the custom data frame for simulating touch. If the frame check is successful, the coordinate position and the operation status are written into the character device file of the virtual device. The structure of the custom data frame includes a frame header (2 bytes 0xcb0xad) + a length (1 byte) + a function code identifier (1 byte) + data (n bytes) + a CRC check bit (2 bytes), the function code corresponds to the coordinate position, and the data corresponds to the operation status.

[0085] The frame checking of the custom data frame of the simulated touch is specifically performed as follows:

[0086] A frame check is performed on the custom data frame of simulated touch according to the frame header and the CRC check bit.

[0087] S6. Write the coordinate position and the operation status into the character device file of the virtual device.

[0088] Specifically, the coordinate position and operation status are assembled into inputevent structure data and written into the character device file of the virtual device. For example, when reporting the horizontal coordinate, type = EV_ABS, code = ABS_X, value = coordinate value; when reporting the pressing operation, type = EV_KEY, code = BTN_TOUCH, value = 1 corresponds to pressing, and value = 0 corresponds to lifting.

[0089] The custom data frame that simulates touch can be used to perform corresponding control operations without the user touching the HMI device on site. It can be used to test the touch screen failure of the on-site HMI device, remote control of the HMI device, or automatic clicking to achieve testing.

[0090] S5-S6 and S2-S4 can be executed in two different service threads respectively.

[0091] Please refer to Figure 2 , Embodiment 2 of the present invention is:

[0092] A Linux-based virtual input terminal comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step of the Linux-based virtual input method in the first embodiment is implemented.

[0093] In summary, the present invention provides a Linux-based virtual input method and terminal, which use the Linux kernel to create a character device file of a virtual device corresponding to an HMI device, read the input event coordinates of the physical touch nodes of the HMI device, and obtain the backlight state of the HMI device. If the backlight state is always on, it means that the current input event is a real operation of the user on the HMI device, and the input event coordinates are written into the character device file of the virtual device. If the backlight state is off, it means that the current input event is just that the user wants to light up the screen, and the system interface is called to light up the backlight, and the input event coordinates are not written into the character device file of the virtual device, and the button operation corresponding to the coordinates is ignored, so as to realize the virtual input according to specific conditions. The software uses the character device file of the virtual device to selectively filter input events, thereby effectively avoiding misoperation of the HMI device; in addition, the custom data frame of simulated touch is monitored, and the coordinate position and operation status therein are written into the character device file of the virtual device. In this way, when the touch panel of the on-site HMI device fails, the custom data frame of simulated touch can also be used to realize virtual input, operate the HMI device normally, and can also be used for automatic testing of the HMI device; at the same time, the input event coordinates are the physical coordinates on the touch panel of the HMI device, and five-point correction is performed on them. The corrected input event coordinates are logical coordinates, and the corrected input event coordinates are written into the character device file of the virtual device, realizing more accurate virtual input.

[0094] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's specification and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A virtual input method based on Linux, characterized in that: Includes steps: Use the Linux kernel to create a character device file for the virtual device corresponding to the HMI device; Reading the input event coordinates of the physical touch node of the HMI device, and obtaining the backlight status of the HMI device; If the backlight state is a constant light state, writing the input event coordinates into the character device file of the virtual device; If the backlight state is off, the system interface is called to light up the backlight, and the input event coordinates are not written into the character device file of the virtual device.

2. A Linux-based virtual input method according to claim 1, characterized in that: Also includes: Monitor a custom data frame of simulated touch, wherein the custom data frame includes a coordinate position and an operation status; The coordinate position and the operation status are written into the character device file of the virtual device.

3. A Linux-based virtual input method according to claim 1, characterized in that: Writing the input event coordinates into the character device file of the virtual device comprises: Performing five-point correction on the input event coordinates to obtain corrected input event coordinates; The corrected input event coordinates are written into the character device file of the virtual device.

4. A Linux-based virtual input method according to claim 1, characterized in that: The character device file of the virtual device corresponding to the HMI device using the Linux kernel includes: Obtain the name of the HMI device and a table of registered physical device names; It is determined whether the name of the HMI device exists in the registered physical device name table. If so, a character device file of a virtual device corresponding to the HMI device is created using the Linux kernel.

5. A Linux-based virtual input method according to claim 2, characterized in that: The custom data frame for monitoring simulated touch includes: A data frame is received, and it is determined whether the data frame is a custom data frame for simulating touch according to a frame header of the data frame. If so, a frame check is performed on the custom data frame for simulating touch. If the frame check is successful, the coordinate position and the operation status are written into the character device file of the virtual device.

6. A Linux-based virtual input terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the following steps are implemented: Use the Linux kernel to create a character device file for the virtual device corresponding to the HMI device; Reading the input event coordinates of the physical touch node of the HMI device, and obtaining the backlight status of the HMI device; If the backlight state is a constant light state, writing the input event coordinates into the character device file of the virtual device; If the backlight state is off, the system interface is called to light up the backlight, and the input event coordinates are not written into the character device file of the virtual device.

7. A Linux-based virtual input terminal according to claim 6, characterized in that: Also includes: Monitor a custom data frame of simulated touch, wherein the custom data frame includes a coordinate position and an operation status; The coordinate position and the operation status are written into the character device file of the virtual device.

8. A Linux-based virtual input terminal according to claim 6, characterized in that: Writing the input event coordinates into the character device file of the virtual device comprises: Performing five-point correction on the input event coordinates to obtain corrected input event coordinates; The corrected input event coordinates are written into the character device file of the virtual device.

9. A Linux-based virtual input terminal according to claim 6, characterized in that: The character device file of the virtual device corresponding to the HMI device using the Linux kernel includes: Obtain the name of the HMI device and a table of registered physical device names; It is determined whether the name of the HMI device exists in the registered physical device name table. If so, a character device file of a virtual device corresponding to the HMI device is created using the Linux kernel.

10. The Linux-based virtual input terminal according to claim 7, characterized in that: The custom data frame for monitoring simulated touch includes: A data frame is received, and it is determined whether the data frame is a custom data frame for simulating touch according to a frame header of the data frame. If so, a frame check is performed on the custom data frame for simulating touch. If the frame check is successful, the coordinate position and the operation status are written into the character device file of the virtual device.

Citation Information

Cited By

  • Screen input event processing method and device and related equipment

    CN122195323A