Event conflict processing method and device

By reading and parsing interaction event data in the driver files of the mobile terminal and injecting events to resolve conflicts, the sharing of gesture events between the HID device and the mobile terminal is achieved, and the flexibility and functional possibilities of human-computer interaction are improved.

CN120179534AActive Publication Date: 2025-06-20广州市品众电子科技有限公司
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510231057.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-28
Publication Date
2025-06-20
Estimated Expiration
2045-02-28

AI Technical Summary

Technical Problem

The gesture events of the mobile terminal cannot be shared with the click and slide events injected by the HID device, resulting in the HID device being unable to use with the gesture events of the mobile terminal.

Method used

Resolve event conflicts by reading the interaction event data corresponding to all input devices in the terminal's driver file, parsing and reassembling them, injecting interaction events.

Benefits of technology

The sharing of gesture events between HID devices and mobile terminals is realized, and the flexibility and functional possibilities of human-computer interaction are improved.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The invention belongs to the technical field of mobile development, and particularly relates to an event conflict processing method and device. The event conflict processing method comprises the following steps: S1, reading interaction event data corresponding to all input devices in a drive file of a terminal; and S2, the interaction event data is analyzed and reassembled, and then the interaction event is injected. According to the invention, the problem of conflict between the gesture event of the mobile terminal and the click and slide events injected by the HID device is solved, so that a user can interact by using a finger while using the HID device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of mobile development, and particularly relates to an event conflict handling method and device. Background Art

[0002] After a mobile terminal is connected to a HID device (Human Interface Device Profile, a human-computer interaction device, such as a mouse, a keyboard, a gamepad, etc.), the gesture events of the mobile terminal and the click and slide events injected by the HID device cannot be shared, resulting in the inability to use the gestures of the mobile terminal and the HID device together.

[0003] For example, after an Android device is connected to a gamepad via Bluetooth, after the gamepad presses a click event, when a finger clicks on the screen of the Android device, the down event of the gamepad will disappear and cannot be used normally, restricting the use of the gamepad. Summary of the Invention

[0004] Aiming at the technical problem that the gesture events of the mobile terminal and the events injected by the HID device cannot be shared, the present invention aims to provide an event conflict handling method and device.

[0005] To solve the foregoing technical problem, a first aspect of the present invention provides an event conflict handling method, which includes:

[0006] S1, reading the interaction event data corresponding to all input devices in the driver file of the terminal;

[0007] S2, parsing and reassembling the interaction event data and then injecting the interaction events.

[0008] Optionally, in the event conflict handling method as described above, the program corresponding to step S1 is deployed on the terminal, and the program corresponding to step S2 is deployed on the server, and the terminal sends the interaction event data to the server through a socket.

[0009] Optionally, in the event conflict handling method as described above, the program corresponding to step S1 is implemented in the C language, and the program corresponding to step S2 is implemented in the Java language.

[0010] Optionally, in the event conflict handling method as described above, in step S1, the driver file is monitored, and when the driver file changes, the interaction event data is read.

[0011] Optionally, in the event conflict handling method as described above, the terminal is an Android end based on the Android operating system.

[0012] Optionally, in the event conflict handling method as described above, in step S2, the interaction event is injected through the injectInputEvent method in the InputManager class.

[0013] Optionally, in the event conflict handling method as described above, the event conflict handling method further includes:

[0014] Pack the program corresponding to step S1 and the program corresponding to step S2 into system executable file packages respectively, preset a script file, the script file can execute the system executable file packages, and copy the system executable file packages and the script file to the system directory of the Android side;

[0015] Extract the socket address and encryption key from the adb source code of the Android side, send an execution command through the socket, execute the script file, and run steps S1 and S2 by executing the script file.

[0016] Optionally, in the event conflict handling method as described above, the event conflict handling method further includes:

[0017] S0, detect whether the USB debugging mode of the terminal is turned on. If the USB debugging mode is not turned on, remind the user to turn on the USB debugging mode and the adb port until both the USB debugging mode and the adb port are turned on.

[0018] To solve the foregoing technical problems, a second aspect of the present invention provides an event conflict handling device, and the event conflict handling device includes:

[0019] A data interception module, configured to read the interaction event data corresponding to all input devices in the driver file of the terminal;

[0020] An event distribution module, configured to parse and reassemble the interaction event data and then inject the interaction event.

[0021] The positive and progressive effects of the present invention are as follows: The present invention solves the conflict problem between the gesture events of the mobile terminal and the click and slide events injected by the HID device, enabling the user to interact with the fingers while using the HID device. Detailed implementation manners

[0022] The following describes the embodiments of the present invention through specific examples. Those skilled in the art can easily understand the other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention.

[0023] It should be noted that, without conflict, the following embodiments and the features in the embodiments can be combined with each other.

[0024] In addition, terms such as "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly specifying the quantity of technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of the present invention, the meanings of "several" and "a number of" are two or more, unless otherwise specifically defined.

[0025] An embodiment of the present invention provides an event conflict handling method. The event conflict handling method includes the following steps:

[0026] S1, Read the interaction event data corresponding to all input devices in the driver file of the terminal.

[0027] S2, Parse and reassemble the interaction event data and then inject the interaction events.

[0028] The interaction event data in the present invention includes HID events such as click events and swipe events triggered on HID devices, and also includes user finger events such as gesture events triggered by a user's finger touching the screen on the terminal. Therefore, the interaction events include events such as DOWN, MOVE, UP, SCROLL, and LONG_PRESS.

[0029] Through the above steps, the present invention can solve the problem that HID events triggered by HID devices such as gamepads cannot be shared with gesture events triggered when a user directly uses the terminal with their fingers.

[0030] After the terminal is connected to the HID device, the HID device can achieve the purpose of interacting with the APP on the terminal. For example, on the Android side, after connecting a gamepad via Bluetooth HID, the gamepad can be emulated as a touchpad device. Through the game hall app, the width and height of the Android device are sent, and the gamepad automatically calculates the events of each button on the screen, emulating the down, move, and up events of the Android system to achieve the press, move, and lift actions on the screen, thus achieving the purpose of simulating a user playing games with their fingers. After the gamepad presses an event, when a finger clicks on the screen of the Android device, the down event of the gamepad will disappear and it cannot be used normally. The underlying logic is that the finger click event and the gamepad click event are not in the same group, resulting in a conflict. Therefore, the reason why the HID events and gesture events of the HID device cannot be used together is that the underlying layers of the two events are not in the same user group.

[0031] The present invention solves the above conflict by reading all the interaction event data in the source code for parsing and distributing HID events and gesture events in the terminal, and injecting all the interaction events in the same group.

[0032] The present invention injects all the interaction event data in the same process and at one entry to solve the event conflict problem. Therefore, the prior art can be used to parse and reassemble the interaction event data. For example, parsing the down, move, and up events and determining the X coordinate, Y coordinate, etc. Reassembly is to queue them according to the order of events or timestamps, etc., and inject the events in sequence.

[0033] When the HID events and gesture events can be used together, the flexibility of human-computer interaction is higher and the functional possibilities are more.

[0034] For example, taking a gamepad as an example, when the gamepad and fingers can be used together, when playing some shooting games, it is more flexible to use fingers to aim and drag the field of view, and the gamepad is used to control the direction to achieve functions such as shooting and jumping, so it can be more accurate. In addition, when implementing some complex operations, through code editing macros, rapid clicking, range clicking, etc., code operation clicking is faster and more accurate than using fingers.

[0035] In some embodiments, the program corresponding to step S1 is deployed on the terminal, and the program corresponding to step S2 is deployed on the server, and the terminal sends the interaction event data to the server via socket.

[0036] A socket is a programming interface (API) for implementing network communication. It provides a standardized way for applications between different operating systems and programming languages to communicate with each other. Specifically, socket communication is mainly to solve the problem of inter-process communication in computer networks. In network programming, two processes need to communicate to complete a specific task. These two processes may run on different computers or in different processes on the same computer. Socket provides a standardized interface that enables these processes to exchange data and communicate in the network.

[0037] In this embodiment, data interaction between the process of the terminal and the process of the server is achieved through socket (socket) technology.

[0038] In some embodiments, the program corresponding to step S1 is implemented in C language, and the program corresponding to step S2 is implemented in Java language.

[0039] In some embodiments, in step S1, the driver file is monitored, and when the driver file changes, the interaction event data is read.

[0040] The change of the driver file in this embodiment can be a change in file size or content. Before performing step S1, a monitoring is first registered to monitor the change of the driver file to determine when to read the data.

[0041] In some embodiments, the terminal is an Android end based on the Android operating system.

[0042] In some embodiments, in step S2, the interaction event is injected through the injectInputEvent method in the InputManager class.

[0043] In some embodiments, the event conflict handling method includes:

[0044] On the terminal, all interaction event data is read from the driver file ( / dev / input) at the bottom layer of the Android end by the C process (a program implemented in C language), and the interaction event data is sent to the Java process (a program implemented in Java language) through the socket.

[0045] On the server side, the interaction event data is parsed by the Java process, reassembled, and the interaction event is injected through the injectInputEvent method in the InputManager class at the bottom layer of the Android operating system. Since the events are all injected in the Java process, the conflict between the interaction events of the HID device and the gesture events is solved.

[0046] In some embodiments, the event conflict handling method further includes:

[0047] Pack the programs corresponding to step S1 and the program corresponding to step S2 into system executable file packages respectively, preset a script file which can execute the system executable file packages, copy the system executable file packages and the script file to the system directory of the Android side; extract the socket address and the encryption key from the adb source code of the Android side, send an execution command through the socket, execute the script file, and run step S1 and step S2 by executing the script file.

[0048] There is an adb process in the Android operating system, and some subprocesses running in the adb process have system permissions. Therefore, in this embodiment, the programs corresponding to step S1 and the program corresponding to step S2 are respectively packed into system executable file jar packages, the two packages and the script file (.sh) are copied to the system directory, and when it is necessary to handle the event conflict problem, an execution command is sent through the socket, and by executing this script file, step S1 and step S2 can be run.

[0049] Specifically, in actual implementation, the execution command sent can be:

[0050] shell,v2,raw:sh / sdcard / zuoyou / inject / tcp.sh&\n

[0051] To execute the tcp.sh file in the system directory and start the C process and the java process through the script file.

[0052] In some embodiments, the event conflict handling method further includes:

[0053] S0, detect whether the USB debugging mode of the terminal is turned on. If the USB debugging mode is not turned on, remind the user to turn on the USB debugging mode and the adb port until both the USB debugging mode and the adb port are turned on.

[0054] Since using the socket to connect to the adb process requires the terminal to be in the USB debugging mode, before performing step S1 and step S2, it is also necessary to ensure that the adb service and port of the terminal are turned on, otherwise the connection cannot be achieved, the execution command cannot be sent through the socket, and step S1 and step S2 cannot be run through the script file. Therefore, in this embodiment, when the USB debugging mode is not turned on, the user is reminded to manually turn on the USB debugging mode. Of course, the process of how to turn on the USB debugging mode can be shown to facilitate the user's manual operation.

[0055] In another embodiment, when it is detected that the USB debugging mode is turned on but the adb port is not open, the user is also reminded to open the adb port until both the USB debugging mode and the adb port are open.

[0056] In this embodiment, the method of opening the adb port uses the prior art. For example, activation tools such as a computer or an activator are used, or functions such as wireless activation are used to open the 5555 port of adb. After the adb port is opened, it is possible to connect to adb through a socket. Opening the adb port completes the activation operation.

[0057] When using an activation tool such as a computer or an activator to open the adb port, a data cable is plugged in between the computer or activator and the Android side to establish a connection, and the adb port is opened through a preset program. Since the operating system after Android 12 comes with a built-in WiFi debugging function, when the Android side has a wireless activation function, the adb port can be directly opened through the Android app.

[0058] In this embodiment, it is possible to facilitate the user's manual operation by showing the process of how to open the adb port.

[0059] The embodiment of the present invention also provides an event conflict handling device, and the event conflict handling device includes:

[0060] A data interception module, configured to read the interaction event data corresponding to all input devices in the driver file of the terminal;

[0061] An event distribution module, configured to parse and reassemble the interaction event data and then inject the interaction event.

[0062] In some embodiments, the data interception module is further configured to monitor the driver file, and when the driver file changes, read the interaction event data.

[0063] In some embodiments, the event conflict handling device includes:

[0064] A command sending module, configured to extract the socket address and the encryption key from the adb source code of the Android side, send an execution command through the socket, and execute a script file. The script file can execute the system executable file package, and there are two system executable file packages, which are respectively the program corresponding to the data interception module and the program corresponding to the event distribution module.

[0065] In some embodiments, the event conflict handling device includes:

[0066] A boot activation module is used to detect whether the USB debugging mode of the terminal is turned on. If the USB debugging mode is not turned on, the user is reminded to turn on the USB debugging mode and the adb port until both the USB debugging mode and the adb port are turned on.

[0067] The above embodiments have described the present invention in detail. Those of ordinary skill in the art can make various variations of the present invention based on the above description. Therefore, certain details in the embodiments should not constitute a limitation on the present invention, and the present invention will be protected by the scope defined in the appended claims.

Claims

1. A method for handling event conflicts, characterized in that: The event conflict handling method comprises: S1, read the interaction event data corresponding to all input devices in the driver file of the terminal; S2, injecting the interactive event after parsing and reassembling the interactive event data.

2. The event conflict handling method according to claim 1, characterized in that: The program corresponding to step S1 is deployed on the terminal, and the program corresponding to step S2 is deployed on the server. The terminal sends the interaction event data to the server through a socket.

3. The event conflict handling method according to claim 1, characterized in that: The program corresponding to step S1 is implemented in C language, and the program corresponding to step S2 is implemented in Java language.

4. The event conflict handling method according to claim 1, characterized in that: In step S1, the driver file is monitored, and when the driver file changes, the interaction event data is read.

5. The event conflict handling method according to any one of claims 1 to 4, characterized in that: The terminal is an Android terminal based on the Android operating system.

6. The event conflict handling method according to claim 5, characterized in that: In step S2, the interactive event is injected through the injectInputEvent method in the InputManager class.

7. The event conflict handling method according to claim 5, characterized in that: The event conflict handling method further includes: The program corresponding to step S1 and the program corresponding to step S2 are respectively packaged into a system executable file package, a script file is preset, and the script file can execute the system executable file package, and the system executable file package and the script file are copied to the system directory of the Android terminal; Extract the socket address and encryption key from the adb source code of the Android end, send an execution command through the socket, execute the script file, and run steps S1 and S2 by executing the script file.

8. The event conflict handling method according to claim 7, characterized in that: The event conflict handling method further includes: S0, detecting whether the USB debugging mode of the terminal is turned on, if the USB debugging mode is not turned on, reminding the user to turn on the USB debugging mode and the adb port until both the USB debugging mode and the adb port are turned on.

9. An event conflict handling device, characterized in that: The event conflict processing device comprises: The data interception module is used to read the interaction event data corresponding to all input devices in the driver file of the terminal; The event distribution module is used to parse and reassemble the interaction event data and then inject the interaction event.

Citation Information

Patent Citations

  • Android joystick virtualization adaptation method and device based on HID channel

    CN107233728A

  • Method for sharing Linux end input event with Android

    CN113157464A

  • Equipment control method and device, terminal equipment and readable storage medium

    CN115237414A

  • Control event processing method, device and equipment and computer storage medium

    CN117170553A

  • Distributed system regression test method and system based on deterministic event injection

    CN118012738A