Mouse data sending method, device, equipment, medium and product
By sending NAK empty packets when the smart mouse device is enumerated and reading key-value data directly in the unenumerated state, the virtual keyboard device loss caused by the time sequence conflict of smart mouse enumeration is solved, and the stability of the mouse device is improved and user experience.
Patent Information
- Application Number
- CN202411270622.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2024-12-06
AI Technical Summary
The enumeration time conflict between smart mouse causes the virtual keyboard device to fail to read preset values normally, resulting in data exceptions and reduced stability.
When the smart mouse device is in the enumeration state, send an empty NAK packet to reply to the input token packet of the host device, avoid timing conflicts, and directly read and send key-value data in the unenumeration state, optimizing the data transmission process.
It improves the stability and reliability of the mouse device, reduces data transmission delay, optimizes user experience and device flexibility, and ensures normal reading of virtual keyboard devices.
Smart Images

Figure CN119094454A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of electronic communication technology, and in particular to a mouse data sending method, device, equipment, medium and product. Background Art
[0002] In the computer device manager, there are usually two devices for intelligent mouse, namely mouse device and virtual keyboard device, which are used for regular mouse operation and custom key operation respectively. There is a parallel timing between the operation component in the intelligent mouse enumerating the virtual keyboard device and the PC reading the data of the mouse device, which will cause the virtual keyboard device to be lost and the preset virtual keyboard value cannot be read normally.
[0003] In view of this, a mouse data sending method capable of improving the stability of the mouse is needed. Summary of the invention
[0004] In view of this, the present invention provides a mouse data sending method to avoid the loss of a virtual keyboard device caused by mouse packet loss and improve the stability of the mouse.
[0005] In a first aspect, the present invention provides a method for sending mouse data, which is executed by an intelligent mouse device, wherein the intelligent mouse device includes a mouse data port and a virtual keyboard data port; the mouse data port is used to read the key value data of the mouse in the intelligent mouse device; the virtual keyboard data port is used to read the key value data of the virtual keyboard in the intelligent mouse device, and the method includes: obtaining the working status of the intelligent mouse device; when the intelligent mouse device is in an enumeration state and receives an input token packet sent by a host device, sending a NAK empty packet to the host device.
[0006] In this embodiment, when the intelligent mouse device is in the enumeration state, by sending a NAK empty packet to reply to the input token packet sent by the host device, data anomalies caused by timing conflicts can be avoided, thereby improving the reliability of the method.
[0007] In an optional implementation, the method further includes: when the intelligent mouse device is not in an enumeration state and receives an input token packet sent by the host device, reading the key value data of the mouse of the intelligent mouse device and sending it to the host device.
[0008] In this embodiment, when the intelligent mouse device is not in the enumeration state and receives an input token packet, the key value data is directly read and transmitted back to the host device, so that the key value data of the intelligent mouse device can be obtained instantly, reducing the delay in the data transmission process.
[0009] In an optional implementation, the method further includes: after the mouse key value data is sent to the host device and when an input token packet sent by the host device is received, reading the key value data of the virtual keyboard of the intelligent mouse device and sending it to the host device.
[0010] In this embodiment, after sending the key value data of the mouse, the key value data of the virtual keyboard is read to the host device, which can optimize the user experience and improve the flexibility of the intelligent mouse device.
[0011] In an optional embodiment, when receiving an input token packet sent by a host device, before obtaining the working status of the intelligent mouse device, the method includes: enumerating the mouse data port; after the enumeration of the mouse data port is completed, sending an enumeration success signal to the host device to instruct the host device to send an input token packet.
[0012] In this embodiment, after the enumeration of the mouse data port is completed, the host device is instructed to send an input token packet, which can ensure that the mouse is correctly connected and reduce the possibility of communication errors.
[0013] In an optional implementation, the method further includes: after the enumeration of the mouse data port is completed, enumerating the virtual keyboard data port.
[0014] In this implementation, by enumerating the mouse data port and the virtual keyboard data port, basic information of the mouse and the virtual keyboard can be obtained, and resources can be allocated according to the needs of the device.
[0015] In a second aspect, the present invention provides a mouse data sending device, which includes: an acquisition module for acquiring the working status of an intelligent mouse device; and an empty packet sending module for sending a NAK empty packet to the host device when the intelligent mouse device is in an enumeration state and receives an input token packet sent by the host device.
[0016] In an optional embodiment, the device also includes: a mouse port enumeration module, which is used to enumerate the mouse data port; and an indication module, which is used to send an enumeration success signal to the host device after the enumeration of the mouse data port is completed, so as to instruct the host device to send an input token packet.
[0017] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the mouse data sending method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0018] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the mouse data sending method of the first aspect or any corresponding embodiment thereof.
[0019] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions, wherein the computer instructions are used to enable a computer to execute the mouse data sending method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 is a flowchart of a method for sending mouse data according to an embodiment of the present invention;
[0022] Figure 2 is a flowchart of another method for sending mouse data according to an embodiment of the present invention;
[0023] Figure 3 is a flowchart of another method for sending mouse data according to an embodiment of the present invention;
[0024] Figure 4 is a structural block diagram of a mouse data sending device according to an embodiment of the present invention;
[0025] Figure 5 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0027] According to an embodiment of the present invention, an embodiment of a mouse data sending method is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0028] In this embodiment, a mouse data sending method is provided, which is executed by an intelligent mouse device. The intelligent mouse device includes a mouse data port and a virtual keyboard data port; the mouse data port is used to read the key value data of the mouse in the intelligent mouse device; the virtual keyboard data port is used to read the key value data of the virtual keyboard in the intelligent mouse device. Figure 1 is a flowchart of a method for sending mouse data according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0029] Step S101, obtaining the working status of the intelligent mouse device.
[0030] When the intelligent mouse device is connected to the USB interface of the computer device that has entered the operating system interface, or when the computer system is restarted after the intelligent mouse device has been connected to the USB interface of the computer device, the intelligent mouse device will enter the enumeration state or the read-write state. When the intelligent mouse device is in the enumeration state, the enumeration device port in the intelligent mouse device will enumerate the mouse data port and the virtual keyboard data port. When the intelligent mouse device is in the read-write state, the intelligent mouse device will read the corresponding key value data from the data port.
[0031] The type of the intelligent mouse device is not limited, as long as it meets the HID (Human Interface Device) USB (Universal Serial Bus) protocol. It can be a wired mouse device with a USB interface or a 2.4G wireless mouse device. The method for obtaining the working status of the intelligent mouse device is not limited, and the working status of the intelligent mouse device can be determined through the device manager on the computer device.
[0032] Step S102: When the intelligent mouse device is in the enumeration state and receives an input token packet sent by the host device, it sends a NAK empty packet to the host device.
[0033] Wherein, the time required for enumeration is not limited and can be determined by the type of the intelligent mouse device. In a practical application, the enumeration time is greater than ten milliseconds and less than one hundred milliseconds.
[0034] The content of the input token packet is not limited and can include information such as the length of the transmitted data. When the intelligent mouse device is in the enumeration state, the data read and write channels in the intelligent mouse device will be occupied. Therefore, when receiving the input token packet sent by the host device, the intelligent mouse device does not read back any key value to the host device to avoid data conflicts.
[0035] After the intelligent mouse device sends a NAK (Negative Acknowledgment) empty packet to the host device, it notifies the host device to resend the input token packet. When the intelligent mouse device is waiting for a newly sent input token packet, a flag can be set to prevent sending additional NAK empty packets while waiting for the host device to respond.
[0036] After sending the NAK empty packet to the host device, when the intelligent mouse device enumeration is completed, the corresponding key value data can be read according to the input token packet sent by the host device, wherein the host device reads the key value data according to the normal read and write timing of the data transmission protocol.
[0037] The mouse data sending method provided in this embodiment can avoid data anomalies caused by timing conflicts by sending a NAK empty packet to reply to the input token packet sent by the host device when the intelligent mouse device is in the enumeration state, thereby improving the reliability of the method.
[0038] In this embodiment, a mouse data sending method is provided, which is executed by an intelligent mouse device. The intelligent mouse device includes a mouse data port and a virtual keyboard data port; the mouse data port is used to read the key value data of the mouse in the intelligent mouse device; the virtual keyboard data port is used to read the key value data of the virtual keyboard in the intelligent mouse device. Figure 2 is a flowchart of a method for sending mouse data according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0039] Step S201, obtaining the working status of the intelligent mouse device.
[0040] For details, please see Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0041] Step S202: When the intelligent mouse device is in the enumeration state and receives an input token packet sent by the host device, it sends a NAK empty packet to the host device.
[0042] For details, please see Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.
[0043] Step S203, when the intelligent mouse device is not in the enumeration state and receives the input token packet sent by the host device, the key value data of the mouse of the intelligent mouse device is read and sent to the host device.
[0044] Among them, when the intelligent mouse device is not in the enumeration state, it means that the read and write channels in the intelligent mouse device are not occupied and are in an idle state. When receiving the input token packet sent by the host device, the key value data of the mouse can be directly read and sent to the host device. Among them, the host device sends the input token packet to the intelligent mouse device and reads the key value data of the mouse from the intelligent mouse device. The time required is not limited and is usually more than ten microseconds. During this period of time, the host device will read the key value data of the mouse according to the data transmission protocol, wherein the data transmission protocol is determined according to the data transmission protocol of the intelligent mouse device. In an actual application, the data transmission protocol is a USB data transmission protocol.
[0045] In some optional implementations, step S203 includes:
[0046] Step S204, after the key value data of the mouse is sent to the host device and when the input token packet sent by the host device is received, the key value data of the virtual keyboard of the intelligent mouse device is read and sent to the host device.
[0047] The host device reads the key value data of the virtual keyboard according to the data transmission protocol. The data transmission protocol is determined according to the data transmission protocol of the intelligent mouse device. In an actual application, the data transmission protocol is a USB data transmission protocol.
[0048] The mouse data sending method provided in this embodiment directly reads the key value data and transmits it back to the host device when the intelligent mouse device is not in the enumeration state and receives the input token packet, so that the key value data of the intelligent mouse device can be obtained instantly, reducing the delay in the data transmission process. After sending the key value data of the mouse, the key value data of the virtual keyboard is read to the host device, which can optimize the user experience and improve the flexibility of the intelligent mouse device.
[0049] In this embodiment, a mouse data sending method is provided, which is executed by an intelligent mouse device. The intelligent mouse device includes a mouse data port and a virtual keyboard data port; the mouse data port is used to read the key value data of the mouse in the intelligent mouse device; the virtual keyboard data port is used to read the key value data of the virtual keyboard in the intelligent mouse device. Figure 3 is a flowchart of a method for sending mouse data according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:
[0050] Step S301, enumerate the mouse data ports.
[0051] After the intelligent mouse device is connected to the host device, the driver of the intelligent mouse device will enumerate the mouse data port, wherein the enumeration includes identifying its function, configuration, etc. After enumeration, the operating system of the host device will allocate a communication port for the mouse and configure the mouse.
[0052] Step S302: After the enumeration of the mouse data port is completed, an enumeration success signal is sent to the host device to instruct the host device to send an input token packet.
[0053] After the enumeration of the mouse data port is completed, the intelligent mouse device will send an enumeration success signal to the host device to prompt the host device to perform data communication with the mouse by sending an input token packet.
[0054] In some optional implementations, the above step S302 further includes:
[0055] Step a1: After the enumeration of the mouse data port is completed, the virtual keyboard data port is enumerated.
[0056] After the intelligent mouse device is connected to the host device, the driver of the intelligent mouse device will enumerate the virtual keyboard data port, wherein the enumeration includes identifying its function, configuration, etc. After enumeration, the operating system of the host device will allocate a communication port for the virtual keyboard and configure the virtual keyboard.
[0057] By enumerating the mouse data port and the virtual keyboard data port, the basic information of the mouse and the virtual keyboard can be obtained, and resources can be allocated according to the needs of the device.
[0058] Step S303, obtaining the working status of the intelligent mouse device.
[0059] For details, please see Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.
[0060] Step S304: When the intelligent mouse device is in the enumeration state and receives an input token packet sent by the host device, it sends a NAK empty packet to the host device.
[0061] For details, please see Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.
[0062] The mouse data sending method provided in this embodiment instructs the host device to send an input token packet after the enumeration of the mouse data port is completed, thereby ensuring that the mouse is correctly connected and reducing the possibility of communication errors.
[0063] In the present embodiment, a mouse data sending device is also provided, which is used to implement the above-mentioned embodiment and preferred implementation mode, and the descriptions have been made no further. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.
[0064] This embodiment provides a mouse data sending device, such as Figure 4 As shown, including:
[0065] The acquisition module 401 is used to acquire the working status of the intelligent mouse device;
[0066] The null packet sending module 402 is used to send a NAK null packet to the host device when the intelligent mouse device is in the enumeration state and receives an input token packet sent by the host device.
[0067] In some optional implementations, the mouse data sending device further includes:
[0068] The key value sending module 403 is used to send key value data to the host device.
[0069] Among them, the key value sending module 403 includes:
[0070] The mouse key value sending unit is used to read the mouse key value data of the intelligent mouse device and send it to the host device when the intelligent mouse device is not in the enumeration state and receives the input token packet sent by the host device.
[0071] The virtual keyboard key value sending unit is used to read the key value data of the virtual keyboard of the intelligent mouse device and send it to the host device after the mouse key value data is sent to the host device and an input token packet sent by the host device is received.
[0072] In some optional implementations, the mouse data sending device further includes:
[0073] A mouse port enumeration module 404 is used to enumerate the mouse data ports;
[0074] The indication module 405 is used to send an enumeration success signal to the host device after the enumeration of the mouse data port is completed, so as to instruct the host device to send an input token packet.
[0075] In some optional implementations, the mouse data sending device further includes:
[0076] The virtual keyboard port enumeration module 406 is used to enumerate the virtual keyboard data port after the enumeration of the mouse data port is completed.
[0077] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0078] The mouse data sending device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0079] The embodiment of the present invention also provides a computer device having the above Figure 4 The mouse data sending device shown.
[0080] See also Figure 5 , Figure 5 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 5 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 5 A processor 10 is taken as an example.
[0081] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0082] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0083] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0084] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0085] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.
[0086] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0087] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0088] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0089] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for sending mouse data, characterized in that: The method is performed by an intelligent mouse device, which includes a mouse data port and a virtual keyboard data port; the mouse data port is used to read the key value data of the mouse in the intelligent mouse device; The virtual keyboard data port is used to read the key value data of the virtual keyboard in the intelligent mouse device, and the method includes: Get the working status of the intelligent mouse device; When the intelligent mouse device is in the enumeration state and receives an input token packet sent by the host device, it sends a NAK empty packet to the host device.
2. The method according to claim 1, characterized in that The method further comprises: When the intelligent mouse device is not in the enumeration state and receives an input token packet sent by the host device, the key value data of the mouse of the intelligent mouse device is read and sent to the host device.
3. The method according to claim 2, characterized in that The method further comprises: After the key value data of the mouse is sent to the host device, and when an input token packet sent by the host device is received, the key value data of the virtual keyboard of the intelligent mouse device is read and sent to the host device.
4. The method according to any one of claims 1 to 3, characterized in that: When receiving an input token packet sent by a host device, before obtaining the working state of the intelligent mouse device, the method includes: Enumerating the mouse data ports; When the enumeration of the mouse data port is completed, an enumeration success signal is sent to the host device to instruct the host device to send the input token packet.
5. The method according to claim 4, characterized in that The method further comprises: After the enumeration of the mouse data port is completed, the virtual keyboard data port is enumerated.
6. A mouse data sending device, characterized in that: The device comprises: The acquisition module is used to obtain the working status of the intelligent mouse device; The empty packet sending module is used to send a NAK empty packet to the host device when the intelligent mouse device is in an enumeration state and receives an input token packet sent by the host device.
7. The device according to claim 6, characterized in that The device also includes: Mouse port enumeration module, used to enumerate mouse data ports; The indication module is used to send an enumeration success signal to the host device after the enumeration of the mouse data port is completed, so as to instruct the host device to send the input token packet.
8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the mouse data sending method according to any one of claims 1 to 5 by executing the computer instructions.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the mouse data sending method according to any one of claims 1 to 5.
10. A computer program product, characterized in that The method comprises computer instructions, wherein the computer instructions are used to cause a computer to execute the mouse data sending method according to any one of claims 1 to 5.
