Event conflict handling method and apparatus

By reading and parsing the interaction event data of the HID device in the driver file of the mobile terminal and reassembling and injecting it on the server side, the problem of event conflict between the mobile terminal and the HID device is solved, enabling the joint use of HID devices and gesture events, and improving the flexibility and accuracy of human-computer interaction.

CN120179534BActive Publication Date: 2025-10-21广州市品众电子科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

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

Method used

By reading interactive event data from the terminal's driver file, parsing and reassembling it on the server side, and then injecting it, data transmission is achieved using sockets, thus realizing unified processing of HID devices and gesture events.

Benefits of technology

It enables the joint use of HID devices and gesture events, improving the flexibility and functionality of human-computer interaction. For example, in games, fingers and game controllers can be used simultaneously for more precise operation.

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

Abstract

The application 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 all input device corresponding interaction event data in the drive file of the terminal; S2, injecting the interaction event after the interaction event data is parsed and reassembled. The application solves the conflict problem between the gesture event of the mobile terminal and the click and sliding event injected by the HID device, so that the user can also use the finger to interact 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 field of mobile development technology, and in particular relates to an event conflict processing method and device. Background Art

[0002] After a mobile terminal is connected to a HID device (Hunman Interface Device Profile, a human-computer interaction device such as a mouse, keyboard, game controller, etc.), the gesture events of the mobile terminal cannot be shared with the click and slide events injected by the HID device, 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 game controller via Bluetooth, after the game controller presses the click event, if you tap the screen of the Android device with your finger, the down event of the game controller will disappear and the game controller will not be able to be used normally, which limits the use of the game controller. Summary of the Invention

[0004] The present invention aims to provide an event conflict processing method and device to solve the technical problem that gesture events of a mobile terminal and events injected by an HID device cannot be shared.

[0005] In order to solve the aforementioned technical problem, a first aspect of the present invention provides an event conflict handling method, the event conflict handling method comprising:

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

[0007] S2, injecting the interactive event after parsing and reassembling the interactive event data.

[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 via socket.

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

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

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

[0012] Optionally, in the event conflict handling method as described above, in step S2, the injection of the interaction event is performed 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] 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;

[0015] 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.

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

[0017] 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.

[0018] In order to solve the aforementioned technical problem, a second aspect of the present invention provides an event conflict handling device, the event conflict handling device comprising:

[0019] The data interception module is used to read the interaction event data corresponding to all input devices in the terminal's driver file;

[0020] The event distribution module is used to parse and reassemble the interaction event data and then inject the interaction event.

[0021] The positive progress of the present invention is that 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, allowing users to interact with the HID device while using their fingers. DETAILED DESCRIPTION

[0022] The following describes the embodiments of the present invention through specific examples. Those skilled in the art will readily understand the other advantages and benefits of the present invention from the disclosure herein. The present invention may also be implemented or applied through various other specific embodiments, and the details in this specification may be modified or altered based on different perspectives and applications without departing from the spirit of the present invention.

[0023] It should be noted that, unless there is any conflict, the following embodiments and features therein may be combined with each other.

[0024] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features. Therefore, the terms "first" and "second" may explicitly or implicitly refer to one or more of these features. Throughout the description of the present invention, "several" and "a number" mean two or more, unless otherwise specifically defined.

[0025] An embodiment of the present invention provides a method for handling event conflicts, the method comprising the following steps:

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

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

[0028] The interaction event data in this invention includes HID events such as click events and slide events triggered on HID devices, as well as user finger events such as gesture events triggered by the user's finger touching the screen on the terminal. Therefore, interaction events include events such as press (DOWN), move (MOVE), lift (UP), scroll (SCROLL), and long press (LONG_PRESS).

[0029] The present invention can solve the problem that HID events triggered by a HID device such as a game controller and gesture events triggered when a user's fingers directly use a terminal cannot be shared through the above steps.

[0030] After the terminal is connected to the HID device, the HID device can achieve the purpose of interaction with the APP on the terminal. For example, on the Android side, after connecting the game controller with Bluetooth HID, the controller can be simulated as a touchpad device. Through the game hall app, the width and height of the Android device are sent, and the controller automatically calculates the events of each button on the screen, simulating the down move up events of the Android system to realize the pressing, moving and lifting actions of the screen, thereby simulating the user using fingers to play games. After the controller press event, the finger clicks the screen of the Android device, the down event of the controller will disappear and cannot be used normally. The underlying logic is because the finger click event and the controller click event are not in the same group, resulting in a conflict. Therefore, the HID event and gesture event of the HID device cannot be used together because the underlying layers of the two events are not in the same user group.

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

[0032] This invention resolves event conflicts by placing all interaction event data within the same process and a single entry point for event injection. Therefore, existing techniques can be used to parse and reassemble interaction event data. For example, parsing down and move up events and determining their X and Y coordinates are performed. Reassembly involves queuing events based on their sequence or timestamps, and then injecting them sequentially.

[0033] When HID events and gesture events can be used together, human-computer interaction becomes more flexible and has more functional possibilities.

[0034] For example, when a game controller and fingers can be used together, shooting games with fingers are more flexible than with a controller for aiming and dragging the field of view, while the controller can be used to control direction, such as shooting and jumping, for greater precision. Furthermore, when implementing complex operations, code-based macros, such as quick clicks and range clicks, are faster and more accurate than 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. The terminal sends the interaction event data to the server through the socket.

[0036] A socket is a programming interface (API) for network communication. It provides a standardized way for applications running on different operating systems and programming languages ​​to communicate with each other. Specifically, socket communication is primarily designed 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. Sockets provide a standardized interface that enables these processes to exchange data and communicate across a network.

[0037] This embodiment implements data interaction between the terminal process and the server process through socket technology.

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

[0039] In some embodiments, in step S1, the driving file is monitored, and when there is a change in the driving file, the interaction event data is read.

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

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

[0042] In some embodiments, in step S2, the injection of interaction events is performed 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 underlying driver file ( / dev / input) on the Android side through 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 and reassembled through the Java process, and the interaction events are injected through the injectInputEvent method in the InputManager class at the bottom of the Android operating system. Since all events are injected in the Java process, the conflict between the interaction events and gesture events of the HID device is resolved.

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

[0047] The program corresponding to step S1 and the program corresponding to step S2 are respectively packaged into system executable file packages, a script file is preset, 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 side; the socket address and encryption key are extracted from the adb source code on the Android side, the execution command is sent through the socket, the script file is executed, and steps S1 and S2 are run by executing the script file.

[0048] The Android operating system has an adb process, and some subprocesses running in the adb process have system permissions. Therefore, in this embodiment, the program corresponding to step S1 and the program corresponding to step S2 are packaged into system executable jar files. These two packages and a script file (.sh) are copied to the system directory. When event conflict issues need to be handled, an execution command is sent through a socket, and executing this script file will execute steps S1 and S2.

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

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

[0051] Execute the tcp.sh file in the system directory and start the C process and Java process through the script file.

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

[0053] S0, detects whether the USB debugging mode of the terminal is turned on. If the USB debugging mode is not turned on, reminds 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] Because using a socket to connect to the adb process requires the terminal to be in USB debugging mode, before proceeding to steps S1 and S2, it is necessary to ensure that the adb service and port are enabled on the terminal. Otherwise, the connection cannot be established, execution commands cannot be sent via the socket, and steps S1 and S2 cannot be executed via the script file. Therefore, this embodiment reminds the user to manually enable USB debugging mode when it is not enabled. Of course, manual operation can be facilitated by demonstrating the process of enabling USB debugging mode.

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

[0056] In this embodiment, the method of opening the ADB port adopts existing technology. For example, using an activation tool such as a computer or an activator, or using a function such as wireless activation, to open ADB port 5555. Once the ADB port is opened, you can connect to ADB via a socket. Opening the ADB port completes the activation operation.

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

[0058] In this embodiment, the process of opening the adb port can be demonstrated to facilitate manual operation by the user.

[0059] An embodiment of the present invention further provides an event conflict handling device, the event conflict handling device comprising:

[0060] The data interception module is used to read the interaction event data corresponding to all input devices in the terminal's driver file;

[0061] The event distribution module is used to parse and reassemble the interactive event data and then inject the interactive event.

[0062] In some embodiments, the data interception module is further used to monitor the driver file and read the interaction event data when there is a change in the driver file.

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

[0064] The sending command module is used to extract the socket address and encryption key from the adb source code on the Android side, send the execution command through the socket, execute the script file, and the script file can execute the system executable file package. There are two system executable file packages, namely 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 apparatus includes:

[0066] The 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 provide a detailed description of the present invention. A person skilled in the art can make various modifications to the present invention based on the above description. Therefore, certain details in the embodiments should not be construed as limiting the present invention, and the present invention shall be protected within the scope defined by the appended claims.

Claims

1. A method for handling event conflicts, characterized in that: The event conflict handling method includes: S1, reading interaction event data corresponding to all input devices in a driver file of a terminal, wherein the terminal is an Android terminal based on an Android operating system; S2, injecting the interaction event after parsing and reassembling the interaction event data, wherein the injection of the interaction event is performed through the injectInputEvent method in the InputManager class; 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.

2. The event conflict handling method according to claim 1, wherein: 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, wherein: 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, wherein: In step S1, the driver file is monitored, and when there is a change in the driver file, the interaction event data is read.

5. The event conflict handling method according to claim 1, wherein: 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.

6. An event conflict processing device, the device being used to implement the event conflict processing method according to claim 1, characterized in that: The event conflict processing device includes: The data interception module is used to read the interaction event data corresponding to all input devices in the terminal's driver file; 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