A mouse key scanning frequency adjusting method, device, equipment and medium
By dynamically configuring the mouse button scanning frequency, the problem of a fixed button scanning rate in existing technologies is solved, enabling flexible adjustment of the button scanning rate and improving user experience and performance.
Patent Information
- Application Number
- CN202511509951.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2045-10-22
AI Technical Summary
The current mouse button scan rate is fixed, which leads to increased power consumption or failure to meet the needs of different usage scenarios. It lacks flexibility and user personalization, and upgrades and iterations are difficult.
By acquiring the key scanning frequency parameters, the interrupt cycle of mouse key scanning is dynamically configured, and key scanning is performed according to the target key scanning frequency, thereby achieving dynamic adjustment of the key scanning frequency.
Users can dynamically adjust the mouse button scan rate according to usage scenarios and needs to provide optimal performance, solving the performance limitation problem caused by a fixed button scan rate and improving user experience and flexibility.
Smart Images

Figure CN120994076B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a mouse key scanning frequency adjusting method, device, equipment and medium. BACKGROUND
[0002] Currently, the market mouse mainly allows users to adjust two core parameters: DPI (dots per inch), that is, optical sensor resolution, which affects the cursor moving speed; and return rate (polling rate), which refers to the frequency of the mouse reporting cursor position data, which affects the cursor moving smoothness and response delay. However, from the user key to the computer receiving signal, there is a key scanning link ignored by the mouse manufacturer and the corresponding parameter key scanning rate. The key scanning rate refers to the frequency of the mouse main control MCU cyclically detecting the physical key state, and high scanning rate can reduce the click delay. The key scanning rate of the existing mouse is preset as a fixed value in the firmware development. Fixed high scanning rate will increase power consumption, and fixed low scanning rate cannot meet the demand of high requirement scene, which makes the mouse difficult to adapt to the use demand of different scenes.
[0003] Therefore, the prior art still needs to be improved and improved. SUMMARY
[0004] The technical problem to be solved by the present application is to provide a mouse key scanning frequency adjusting method, device, equipment and medium to solve the problems of the prior art.
[0005] In order to solve the above technical problems, the first aspect of the present application provides a mouse key scanning frequency adjusting method, which specifically comprises:
[0006] Obtaining a key scanning frequency parameter, and determining a target key scanning frequency of the mouse according to the key scanning frequency parameter;
[0007] According to the target key scanning frequency, dynamically configuring the interrupt period of the mouse key scanning to adjust the key scanning frequency of the mouse to the target key scanning frequency;
[0008] According to the target key scanning frequency, triggering the interrupt to perform key scanning according to the key scanning frequency.
[0009] The mouse key scanning frequency adjusting method, wherein the obtaining of the key scanning frequency parameter specifically comprises:
[0010] Receiving a configuration instruction sent by a host connected with the mouse, wherein the configuration instruction contains a key scanning frequency parameter;
[0011] Parsing the configuration instruction to obtain the key scanning frequency parameter.
[0012] The mouse key scanning frequency adjustment method, wherein, before the receiving of the configuration instruction sent by the host end connected with the mouse, the method further comprises:
[0013] receiving a key scanning frequency parameter input by a user through a display interface of the host end;
[0014] generating the configuration instruction through a software driver layer in the host end based on the key scanning frequency parameter, and sending the configuration instruction to the mouse.
[0015] The mouse key scanning frequency adjustment method, wherein, before the receiving of the configuration instruction sent by the host end connected with the mouse, the method further comprises:
[0016] identifying a foreground application currently running in the host end through a software driver layer in the host end, and determining the key scanning frequency parameter of the mouse according to the foreground application;
[0017] generating the configuration instruction through the software driver layer in the host end based on the key scanning frequency parameter, and sending the configuration instruction to the mouse.
[0018] The mouse key scanning frequency adjustment method, wherein, after the obtaining of the key scanning frequency parameter and the determining of the target key scanning frequency of the mouse according to the key scanning frequency parameter, the method further comprises:
[0019] obtaining a current device state of the mouse;
[0020] adjusting the target key scanning frequency according to the current device state, so that the target key scanning frequency is adapted to the device state of the mouse.
[0021] The mouse key scanning frequency adjustment method, wherein, the obtaining of the key scanning frequency parameter specifically comprises:
[0022] obtaining device data of the mouse, wherein the device data comprises historical use information and / or a current device state;
[0023] determining the key scanning frequency parameter according to the device data.
[0024] The mouse key scanning frequency adjustment method, wherein, the determining of the key scanning frequency parameter according to the device data specifically comprises:
[0025] if the device data comprises historical use information and a current device state, determining a first key scanning frequency parameter according to the historical use information;
[0026] Detect whether the current device status supports the first key scan frequency parameter;
[0027] If the first key scan frequency parameter is supported, then the first key scan frequency parameter is used as the key scan frequency parameter.
[0028] If the first key scan frequency parameter is not supported, then the second key scan frequency parameter is determined based on the current device status, and the key scan frequency parameter is used as the key scan frequency parameter.
[0029] The mouse button scanning frequency adjustment method includes, wherein the historical usage information includes one or more of the following: the number of clicks within a preset time period, the movement distance within a preset time period, and the difference in the number of clicks between two preset time periods; and the current device status includes hardware resource usage and / or battery status.
[0030] The mouse button scanning frequency adjustment method wherein the button scanning frequency parameter is one of the following: target button scanning frequency, button scanning time interval, scanning mode, scanning frequency level and scanning frequency level adjustment amount, button scanning frequency adjustment amount and button scanning time interval adjustment amount.
[0031] The mouse button scanning frequency adjustment method, wherein after determining the target button scanning frequency of the mouse based on the button scanning frequency parameters, the method further includes:
[0032] The target key scanning frequency is saved to the storage area of the mouse so that the target key scanning frequency can be read from the storage area by the mouse.
[0033] The mouse button scanning frequency adjustment method, wherein, before dynamically configuring the interrupt period of the mouse button scanning according to the target button scanning frequency to adjust the mouse button scanning frequency to the target button scanning frequency, the method further includes:
[0034] The validity of the target key scanning frequency is verified.
[0035] If the validity check passes, then the step of dynamically configuring the interrupt period of the mouse button scanning according to the target button scanning frequency is executed to adjust the mouse button scanning frequency to the target button scanning frequency.
[0036] If the validity check fails, an adjustment failure message will be displayed.
[0037] The mouse button scanning frequency adjustment method, wherein the step of dynamically configuring the interrupt period of the mouse button scanning according to the target button scanning frequency to adjust the mouse button scanning frequency to the target button scanning frequency specifically includes:
[0038] Read the current button scanning frequency of the mouse and calculate the button scanning frequency difference between the target button scanning frequency and the current button scanning frequency;
[0039] When the difference in the button scanning frequency is less than or equal to a preset difference threshold, the interrupt period of the mouse's hardware timer is configured according to the target button scanning frequency so as to adjust the mouse's button scanning frequency to the target button scanning frequency.
[0040] When the difference between the button scanning frequencies is greater than the preset difference threshold, an intermediate button scanning frequency is configured between the current button scanning frequency and the target button scanning frequency based on the preset difference threshold. The intermediate button scanning frequency and the target button scanning frequency are then configured to the interrupt period of the mouse's hardware timer in ascending order of button scanning frequency, so as to adjust the mouse's button scanning frequency to the target button scanning frequency.
[0041] The mouse button scanning frequency adjustment method, wherein after triggering an interrupt according to the target button scanning frequency to perform button scanning according to the button scanning frequency, the method further includes:
[0042] Detect the button scanning status of the mouse;
[0043] If the key scan status is abnormal, the key scan frequency for repair is obtained according to the type of abnormality, wherein the types of abnormality include interruption triggering abnormality and scan task abnormality;
[0044] Configure the interrupt period of the mouse's hardware timer according to the repaired button scanning frequency to restore the mouse's button scanning frequency to the repaired button scanning frequency.
[0045] A second aspect of this application provides a mouse button scanning frequency adjustment device, wherein the mouse button scanning frequency adjustment device specifically includes:
[0046] The acquisition module is used to acquire key scanning frequency parameters and determine the target key scanning frequency of the mouse based on the key scanning frequency parameters.
[0047] The configuration module is used to dynamically configure the interrupt cycle of the mouse button scanning according to the target button scanning frequency, so as to adjust the mouse button scanning frequency to the target button scanning frequency.
[0048] The control module is used to trigger an interrupt according to the target key scanning frequency so as to perform key scanning according to the key scanning frequency.
[0049] A third aspect of this application provides a computer-readable storage medium storing one or more programs that can be executed by one or more processors to implement the steps in the mouse button scanning frequency adjustment method described above.
[0050] A fourth aspect of this application provides a mouse comprising: a processor and a memory;
[0051] The memory stores a computer-readable program that can be executed by the processor;
[0052] When the processor executes the computer-readable program, it implements the steps in any of the above-described mouse button scan frequency adjustment methods.
[0053] Beneficial Effects: Compared with the prior art, this application provides a method, apparatus, device, and medium for adjusting mouse button scanning frequency. The method includes acquiring button scanning frequency parameters and determining a target button scanning frequency for the mouse based on the button scanning frequency parameters; dynamically configuring the interrupt period of the mouse button scanning according to the target button scanning frequency to adjust the mouse button scanning frequency to the target button scanning frequency; and triggering an interrupt according to the target button scanning frequency to perform button scanning at the target button scanning frequency. This application can dynamically configure the interrupt period of the mouse hardware timer based on the acquired scanning frequency parameters, thereby adjusting the mouse button scanning frequency. This allows users to dynamically adjust the mouse button scanning rate according to usage scenarios and needs, thus providing optimal performance in different applications and solving the performance limitation problem caused by a fixed mouse button scanning rate in the prior art. Attached Figure Description
[0054] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0055] Figure 1 A flowchart of a mouse button scanning frequency adjustment method provided in an embodiment of this application.
[0056] Figure 2 A timing diagram of one implementation of the mouse button scanning frequency adjustment method provided in the embodiments of this application.
[0057] Figure 3A schematic diagram of the mouse button scanning frequency adjustment device provided in the embodiments of this application.
[0058] Figure 4 A schematic diagram of the principle of a mouse provided in an embodiment of this application. Detailed Implementation
[0059] This application provides a method, apparatus, device, and medium for adjusting the scanning frequency of mouse buttons. To make the objectives, technical solutions, and effects of this application clearer and more explicit, the following detailed description is provided with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only for explaining this application and are not intended to limit this application.
[0060] Those skilled in the art will understand that, unless specifically stated otherwise, the singular forms “a,” “an,” “the,” and “the” used herein may also include the plural forms. It should be further understood that the term “comprising” as used in this application means the presence of the stated features, integers, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups thereof. It should be understood that when we say an element is “connected” or “coupled” to another element, it can be directly connected or coupled to the other element, or there may be intermediate elements. Furthermore, “connected” or “coupled” as used herein can include wireless connections or wireless coupling. The term “and / or” as used herein includes all or any units and all combinations of one or more associated listed items.
[0061] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0062] It should be understood that the sequence number and size of each step in this embodiment do not imply the order of execution. The execution order of each process is determined by its function and internal logic, and should not constitute any limitation on the implementation process of this application embodiment.
[0063] Research has revealed that most mice on the market currently allow users to adjust two core parameters:
[0064] DPI (dots per inch): refers to the resolution of the optical sensor, which affects the speed at which the cursor moves on the screen.
[0065] Polling rate: refers to the frequency at which the mouse reports the cursor position data to the computer (such as 125Hz, 500Hz, 1000Hz), which affects the smoothness of cursor movement and response latency.
[0066] However, between the user pressing a physical button and the computer receiving the click signal, there is a crucial step that has long been overlooked by all mouse manufacturers—button scanning, and the corresponding parameter, the button scan rate. The button scan rate refers to the frequency at which the mouse's main control MCU (microcontroller unit) continuously checks whether physical buttons (such as the left, right, and side buttons) are pressed. A high scan rate means that after a button is pressed, the MCU can detect the action more quickly, thus reducing click latency.
[0067] In existing mice, the button scan rate is typically preset to a fixed value during firmware development and written into the MCU code, making it impossible for users to change according to their usage scenarios and needs. This leads to the following problems:
[0068] 1. Lack of flexibility: A fixed high scan rate will increase the MCU's power consumption in unnecessary scenarios; a fixed low scan rate cannot meet the high requirements of scenarios such as e-sports.
[0069] 2. Limited user experience: Users cannot personalize the mouse's response characteristics.
[0070] 3. Difficult to upgrade and iterate: If the scan rate needs to be changed, the firmware must be re-flashed, which is difficult for ordinary users to do.
[0071] To address this, this application provides a method for adjusting mouse button scanning frequency. The method includes acquiring button scanning frequency parameters and determining a target button scanning frequency for the mouse based on these parameters; dynamically configuring the interrupt period of the mouse button scanning based on the target button scanning frequency to adjust the mouse button scanning frequency to the target frequency; and triggering an interrupt based on the target button scanning frequency to perform button scanning at that frequency. This application can dynamically configure the interrupt period of the mouse hardware timer based on the acquired scanning frequency parameters, thereby adjusting the mouse button scanning frequency. This allows users to dynamically adjust the mouse button scanning rate according to usage scenarios and needs, providing optimal performance in different applications. It not only solves the performance limitation problem caused by a fixed mouse button scanning rate in existing technologies but also allows users to personalize the mouse's response characteristics, bringing convenience to users.
[0072] The application content will be further explained below with reference to the accompanying drawings and the description of the embodiments.
[0073] This embodiment provides a method for adjusting the scanning frequency of mouse buttons, such as... Figure 1As shown, the method specifically includes:
[0074] S10. Obtain the button scanning frequency parameters and determine the target button scanning frequency of the mouse based on the button scanning frequency parameters.
[0075] Specifically, the scanning frequency parameter is the basis for adjusting the mouse's button scanning frequency. Based on this parameter, the adjusted button scanning frequency (i.e., the target button scanning frequency) can be determined. The scanning frequency parameter includes one of the following: target button scanning frequency, button scanning time interval (i.e., the time interval between two reads of button key value I / O states by the mouse MCU), scanning mode, scanning frequency level and its adjustment amount, button scanning frequency adjustment amount, and button scanning time interval adjustment amount. The target button scanning frequency is the adjusted button scanning frequency of the mouse, determined based on the button scanning frequency parameter, and stored in the mouse's storage area (such as EEPROM or Flash). In other words, the mouse stores the button scanning frequency in its storage area, allowing adjustment of the button scanning frequency by storing the target button scanning frequency in the mouse's storage area.
[0076] Based on this, after determining the target button scanning frequency of the mouse according to the button scanning frequency parameters, the method further includes: saving the target button scanning frequency to the storage area of the mouse, so that the mouse can read the target button scanning frequency from the storage area. The storage area may store one or more button scanning frequencies, and each button scanning frequency stored in the storage area has a storage time, so that when the mouse experiences adjustment abnormalities due to abnormal button scanning frequency parameters, the scanning frequency parameters can be retrieved from the storage area based on the storage time.
[0077] Furthermore, the button scanning frequency parameter is one of the following: target button scanning frequency, button scanning time interval, scanning mode, scanning frequency level and adjustment amount of scanning frequency level, button scanning frequency adjustment amount, and button scanning time interval adjustment amount. The process of determining the target button scanning frequency of the mouse based on the button scanning frequency parameter can be as follows:
[0078] If the key scan frequency parameter is the key scan frequency, then the key scan frequency is used as the target key scan frequency.
[0079] If the key scan frequency parameter is the key scan time interval, the target key scan frequency is determined based on the correspondence between the key scan time interval and the key scan frequency (e.g., key scan frequency of 1000Hz, key scan interval of 1ms; key scan frequency of 2000Hz, key scan interval of 0.5ms; key scan frequency of 8000Hz, key scan interval of 0.125ms, etc.).
[0080] If the key scanning frequency parameter is a scanning mode, the target key scanning frequency is determined according to the preset correspondence between the scanning mode and the key scanning frequency (e.g., if the scanning model is an office model, the key scanning frequency is 1000Hz; if the scanning model is a game model, the key scanning frequency is 8000Hz, etc.).
[0081] If the key scanning frequency parameter is a scanning frequency level, the target key scanning frequency is determined according to the preset correspondence between the scanning frequency level and the key scanning frequency (e.g., scanning frequency level 1, key scanning frequency is 1000Hz; scanning frequency level 2, key scanning frequency is 2000Hz; scanning frequency level 8, key scanning frequency is 8000Hz, etc.).
[0082] If the key scan frequency parameter is the scan frequency level adjustment amount, obtain the current scan frequency level, determine the target scan frequency level based on the current scan frequency level and the scan frequency level adjustment amount, and then determine the target key scan frequency based on the preset correspondence between the scan frequency level and the key scan frequency.
[0083] If the key scan frequency parameter is the key scan frequency adjustment amount, obtain the current key scan frequency, and then determine the target key scan frequency based on the current key scan frequency and the key scan frequency adjustment amount;
[0084] If the key scan frequency parameter is the key scan time interval adjustment amount, obtain the current key scan time interval, calculate the target scan time interval based on the current key scan time interval and the key scan time interval adjustment amount, and then calculate the key scan frequency per unit time based on the target key scan time interval to obtain the target key scan frequency.
[0085] In one embodiment, obtaining the key scan frequency parameter specifically includes:
[0086] Receive configuration commands sent by the host computer to which the mouse is connected;
[0087] The configuration instructions are parsed to obtain the key scanning frequency parameters.
[0088] Specifically, the configuration command is sent from the host to the mouse, instructing it to adjust the button scanning frequency according to the parameters specified in the configuration command. In other words, the configuration command includes the button scanning frequency parameters. Upon receiving the configuration command, the mouse can first verify it. If the verification passes, it can parse the configuration command to obtain the button scanning frequency parameters. The verification may include modification permission verification and / or device identification verification. Modification permission verification checks whether the host has the authority to adjust the button scanning frequency parameters, while device identification verification verifies the legitimacy of the host device.
[0089] Furthermore, since the configuration command is sent from the host to the mouse, the host will generate the configuration command and send it to the mouse before the mouse receives it. That is, before receiving the configuration command sent by the host connected to the mouse, the method also includes a configuration command generation process, through which a configuration command is generated and sent to the mouse. The configuration command can be generated by the host based on user commands, automatically generated by the host based on its own operating status, or generated by the host based on both user commands and its own operating status, etc. Two specific implementation methods for configuration command generation are given here.
[0090] In one specific implementation, before receiving the configuration command sent by the host terminal connected to the mouse, the method further includes:
[0091] The host computer receives the key scanning frequency parameters input by the user through its display interface.
[0092] Based on the key scanning frequency parameters, the configuration instructions are generated by the software driver layer in the host and sent to the mouse.
[0093] Specifically, such as Figure 2 As shown, users can input key scanning frequency parameters on the display interface of the host. The key scanning frequency parameters can be input directly by the user via voice or text, or by performing a selection operation on the key scanning frequency parameters displayed on the display interface, or by triggering a preset key scanning frequency button, etc.
[0094] After the user inputs the key scan frequency parameters, these parameters are transmitted to the software driver layer on the active end. The active end's software driver layer generates configuration instructions based on these parameters, using the key scan frequency parameters as the instruction information carried within the configuration instructions. Then, the host end's software driver layer sends the configuration instructions to the mouse through the connection method between the host and the mouse. For example, when the mouse is connected to the host via USB, the host end's software driver layer sends the instructions to the mouse via USB; when the mouse is connected to the host via Bluetooth or other wireless communication methods, the host end's software driver layer sends the instructions to the mouse via Bluetooth or other wireless communication methods.
[0095] In another specific implementation, before receiving the configuration command sent by the host terminal connected to the mouse, the method further includes:
[0096] The software driver layer in the host identifies the foreground application currently running on the host and determines the mouse button scanning frequency parameters based on the foreground application.
[0097] Based on the key scanning frequency parameters, the configuration instructions are generated by the software driver layer in the host and sent to the mouse.
[0098] Specifically, a foreground application refers to an application that is currently running in the foreground, such as an office application or a game application. After obtaining the currently running foreground application, it can first be checked whether the currently running foreground application has changed from the foreground application running at the previous moment. If it has changed, the mouse button scanning frequency parameters are determined based on the foreground application. If it has not changed, the identification of the currently running foreground application on the host side continues.
[0099] Furthermore, when determining the mouse's button scanning frequency parameters based on the foreground application, the application's program type can be obtained. Then, the mouse's button scanning frequency parameters are determined according to the correspondence between program type and button scanning frequency. The program type can include office applications, games, and video applications. The program type can be preset by the driver software or defined by the user. If the currently running foreground application is a game, the button scanning frequency corresponding to that game type can be read, and the button scanning frequency parameters can be determined based on that frequency. For example, if the currently running program is a game, 8000Hz (corresponding to the game type) can be used as the target button scanning frequency to improve mouse response speed; if the currently running program is an office application, 1000Hz (corresponding to the office application type) can be used as the target button scanning frequency to save mouse power.
[0100] It should be noted that, in order to ensure the accuracy of the key scanning frequency adjustment, after identifying the currently running foreground application, it is possible to check whether the program type of the currently running foreground application is the same as that of the previously running foreground application. If the program types are the same, the key scanning frequency remains unchanged (i.e., no configuration command is generated). If the program types are different, the key scanning frequency parameters of the mouse are determined according to the foreground application.
[0101] Of course, in practical applications, when determining the mouse button scanning frequency parameters based on the foreground application, it's also possible to first determine whether a button scanning frequency corresponding to the foreground application is pre-configured. If pre-configured, the button scanning frequency parameters are determined based on the foreground application; if not pre-configured, the application type of the foreground application is obtained, allowing users to set a specific button scanning frequency for a specific application according to their needs. For example, if user A is a player of game XX, when user A uses the game application, the mouse button scanning frequency can be directly configured to the fixed scanning frequency that user A uses when using the game application, allowing users to more accurately predict mouse response time.
[0102] In one embodiment, since the key scan frequency parameters are sent to the mouse from the host, especially when the key scan frequency parameters are set by the user, there may be a situation where the target key scan frequency determined based on the key scan frequency parameters is incompatible with the mouse, leading to abnormal mouse response. Therefore, after obtaining the target key scan frequency, the target key scan frequency can be adjusted to make the adjusted target key scan frequency compatible with the mouse. Based on this, after obtaining the key scan frequency parameters and determining the target key scan frequency of the mouse based on the key scan frequency parameters, the method further includes:
[0103] Obtain the current device status of the mouse;
[0104] The target button scanning frequency is adjusted according to the current device status so that the target button scanning frequency is adapted to the device status of the mouse.
[0105] Specifically, the current device status reflects the mouse's usage status, which may include hardware resource usage and / or battery status. That is, after determining the target button scanning frequency of the mouse, the target button scanning frequency can be adjusted using the current device status. This adjustment process can be as follows: obtain the hardware resources and / or power consumption required for the target button scanning frequency; then check whether the current device status meets the required hardware resources and / or power consumption for the target button scanning frequency. If it does, the target button scanning frequency is kept unchanged; if not, the target button scanning frequency is adjusted according to the current device status to ensure that the current device status meets the required hardware resources and / or power consumption for the target button scanning frequency. Meeting the required hardware resources means that the mouse's available hardware resources are greater than or equal to the required hardware resources, and meeting the power consumption requirements means that the remaining battery power can allow the mouse to be used for at least a predetermined time (e.g., 1 hour) at that power consumption level.
[0106] It should be noted that when the current device status includes hardware resource usage, only whether the required hardware resources are met; when the current device status includes battery status, only whether the power consumption is met; when the current device status includes both hardware resource usage and battery status, both the required hardware resources and the power consumption are met.
[0107] After determining the target button scanning frequency, this application adjusts the target button scanning frequency based on the current device state of the mouse, so that the adjusted target button scanning frequency can achieve a balance between performance and power consumption, and reasonably meet user needs.
[0108] The above example illustrates the process of obtaining button scan frequency parameters using the host computer as an example. However, in practical applications, besides the host computer controlling the mouse to adjust the button scan frequency, the mouse can automatically adjust its button scan frequency. That is, the mouse can obtain the button scan frequency parameters independently without host computer intervention and determine the target button scan frequency based on these parameters. Therefore, the process of the mouse automatically obtaining button scan frequency parameters without host computer intervention will be explained below.
[0109] In one embodiment, obtaining the key scan frequency parameter specifically includes:
[0110] Obtain the device data of the mouse;
[0111] The key scanning frequency parameters are determined based on the device data.
[0112] Specifically, the device data includes historical usage information and / or current device status. The historical usage information includes one or more of the following: the number of clicks within a preset time period, the movement distance within a preset time period, and the difference in the number of clicks between two preset time periods. The current device status includes hardware resource usage and / or battery status. The preset time period can be a time period prior to the current time, allowing the mouse to adjust its button scanning frequency in real time based on its usage; or it can be the running time period of the previous running foreground application on the host computer, allowing the mouse to automatically adjust its button scanning frequency based on the foreground application running on the host computer.
[0113] When determining the key scanning frequency parameters based on device data, the key scanning frequency parameters can be obtained directly according to the pre-set correspondence between device data and key scanning frequency parameters. Alternatively, the device data, including data information items (i.e., historical usage information, current device status), can be obtained first, and then the key scanning frequency parameters corresponding to each data information item can be obtained. Then, one key scanning frequency parameter can be selected from all the obtained key scanning frequency parameters. Alternatively, priorities can be configured for the data information items in the device data, and then the key scanning frequency parameter corresponding to the data information item with the highest priority can be selected.
[0114] In one specific implementation, determining the key scanning frequency parameter based on the device data specifically includes:
[0115] If the device data includes historical usage information and current device status, then the first key scan frequency parameter is determined based on the historical usage information;
[0116] Detect whether the current device status supports the first key scan frequency parameter;
[0117] If the first key scan frequency parameter is supported, then the first key scan frequency parameter is used as the key scan frequency parameter.
[0118] If the first key scan frequency parameter is not supported, then the second key scan frequency parameter is determined based on the current device status, and the key scan frequency parameter is used as the key scan frequency parameter.
[0119] Specifically, the first key scanning frequency parameter is determined based on historical usage information. The determination process can involve inputting the historical usage information into a preset prediction model and outputting the first key scanning frequency parameter through the preset prediction model, or directly determining the first key scanning frequency parameter based on the correspondence between preset historical usage information and key scanning frequencies. The process of determining the first key scanning frequency parameter based on the historical usage information can be as follows:
[0120] When the historical usage information includes the number of clicks within a preset time period, the first key scanning frequency is determined according to the correspondence between the preset number of clicks and the key scanning frequency. The preset number of clicks is proportional to the key scanning frequency so that the mouse key scanning frequency matches the intensity of user activity.
[0121] When the historical usage information includes the movement distance within a preset time period, the first key scanning frequency is determined according to the correspondence between the movement distance within the preset time period and the key scanning frequency, so that the mouse key scanning frequency matches the intensity of user activity.
[0122] When the historical usage information includes the difference in the number of clicks within two preset time periods, the button scanning frequency adjustment amount is determined based on the difference in the number of clicks within the two preset time periods. Then, the first button scanning frequency is determined based on the button scanning frequency adjustment amount, so that the button scanning frequency of the mouse matches the intensity of user activity.
[0123] When the historical usage information includes at least two of the following: the number of clicks within a preset time period, the movement distance within a preset time period, and the difference in the number of clicks between two preset time periods, the key scanning frequency corresponding to each historical usage information item is first obtained. Then, the obtained key scanning frequencies are weighted according to the weighting coefficient corresponding to each historical usage information item to obtain the first key scanning frequency. The weighting coefficient can be preset or determined according to the program type of the foreground running program, etc.
[0124] After obtaining the first button scan frequency parameter, it can be checked whether the current device status supports the first button scan frequency parameter. This detection process can be as follows: obtain the hardware resources and / or power consumption required for the target button scan frequency; then check whether the current device status meets the required hardware resources and / or power consumption for the target button scan frequency. If it does, it is directly determined that the first button scan frequency parameter is supported; if it does not, it is determined that the first button scan frequency parameter is not supported. Here, meeting the required hardware resources means that the mouse's available hardware resources are greater than or equal to the required hardware resources, and meeting the power consumption means that the remaining battery power can allow the mouse to be used for at least a predetermined time (e.g., 1 hour) under that power consumption.
[0125] It should be noted that when the current device status includes hardware resource usage, only whether the required hardware resources are met; when the current device status includes battery status, only whether the power consumption is met; when the current device status includes both hardware resource usage and battery status, both the required hardware resources and the power consumption are met.
[0126] Furthermore, if the first key scan frequency parameter is not supported, a second key scan frequency parameter will be determined based on the current device status. The process of determining the second key scan frequency parameter first obtains the set of key scan frequency parameters supported by the current device status, and then selects the key scan frequency parameter closest to the first key scan frequency parameter from the set of key scan frequency parameters as the second key scan frequency parameter. In this way, the key scan frequency that best meets the user's needs and satisfies the current device status can be set as the target key scan frequency, maximizing the convenience for the user.
[0127] S20. Dynamically configure the interrupt cycle of the mouse button scanning according to the target button scanning frequency, so as to adjust the mouse button scanning frequency to the target button scanning frequency.
[0128] Specifically, the mouse button scanning interrupt cycle controls the mouse to trigger the button scanning program at fixed, periodic time intervals (e.g., every 10ms), ensuring that the triggering frequency of the button scanning program is the target button scanning frequency. The mouse button scanning interrupt cycle can be managed by a hardware timer interrupt. Therefore, in one specific implementation, the mouse button scanning interrupt cycle can be implemented by configuring the hardware timer's interrupt cycle. The hardware timer's interrupt cycle refers to the time elapsed from the timer counter starting from its initial value (or auto-reload value) until it reaches the target value (usually 0 or the reload value) and generates an interrupt request. The timer clock source frequency is the target button scanning frequency. In other words, the target button scanning frequency is used as the timer clock source frequency, then the number of counts required by the counter is calculated based on the timer clock source frequency, and finally, the hardware timer's interrupt cycle is calculated based on the number of counts required by the counter.
[0129] Furthermore, since mice are generally configured with an upper limit (e.g., 8000Hz) and a lower limit (e.g., 100Hz) for button scanning frequency, the target button scanning frequency can be verified before dynamically configuring the interrupt period of the mouse button scanning according to the target button scanning frequency, thus avoiding the problem of target button scanning frequency overflow. Based on this, before dynamically configuring the interrupt period of the mouse button scanning according to the target button scanning frequency to adjust the mouse button scanning frequency to the target button scanning frequency, the method further includes:
[0130] The validity of the target key scanning frequency is verified.
[0131] If the validity check passes, then the step of dynamically configuring the interrupt period of the mouse button scanning according to the target button scanning frequency is executed to adjust the mouse button scanning frequency to the target button scanning frequency.
[0132] If the validity check fails, an adjustment failure message will be displayed.
[0133] Specifically, the validity check is used to verify whether the target button scanning frequency is the button scanning frequency supported by the mouse. That is, it checks whether the target button scanning frequency is between the upper limit and the lower limit of the button scanning frequency. When the target button scanning frequency is between the upper limit and the lower limit of the button scanning frequency, the validity check is deemed to have passed; otherwise, when the target button scanning frequency is not between the upper limit and the lower limit of the button scanning frequency, the validity check is deemed to have failed.
[0134] In one embodiment, dynamically configuring the interrupt period of the mouse button scanning according to the target button scanning frequency to adjust the mouse button scanning frequency to the target button scanning frequency specifically includes:
[0135] Read the current button scanning frequency of the mouse and calculate the button scanning frequency difference between the target button scanning frequency and the current button scanning frequency;
[0136] When the difference in the button scanning frequency is less than or equal to a preset difference threshold, the interrupt period of the mouse's hardware timer is configured according to the target button scanning frequency to adjust the mouse's button scanning frequency to the target button scanning frequency.
[0137] When the difference between the button scanning frequencies is greater than the preset difference threshold, an intermediate button scanning frequency is configured between the current button scanning frequency and the target button scanning frequency based on the preset difference threshold. The intermediate button scanning frequency and the target button scanning frequency are then configured in ascending order of button scanning frequency to adjust the button scanning frequency of the mouse to the target button scanning frequency.
[0138] Specifically, the preset difference threshold is pre-set to ensure the smoothness of the button scanning frequency. That is, when the difference in button scanning frequencies exceeds the preset difference threshold, directly setting the mouse's button scanning frequency to the target frequency would cause the user to experience mouse lag. Therefore, when the difference in button scanning frequencies exceeds the preset difference threshold, a gradual adjustment strategy can be adopted to make the button scanning frequency gradually approach the target frequency. Specifically, the gradual adjustment strategy involves configuring an intermediate button scanning frequency based on the preset difference threshold between the current and target button scanning frequencies, and ensuring that the difference between any two adjacent button scanning frequencies is less than or equal to the preset difference threshold after the intermediate and target button scanning frequencies are arranged in ascending order.
[0139] After obtaining the intermediate button scanning frequency, the intermediate button scanning frequency and the target button scanning frequency are configured in ascending order to adjust the interrupt period of the mouse's hardware timer. This makes the interrupt period of the hardware timer gradually approach the interrupt period corresponding to the target button scanning frequency. This not only adjusts the mouse's button scanning frequency to the target button scanning frequency, but also ensures the smoothness of the adjustment process.
[0140] S30. Trigger an interrupt according to the target key scanning frequency to perform key scanning according to the key scanning frequency.
[0141] Specifically, after adjusting the target button scanning frequency to match the mouse button scanning frequency, an interrupt will be triggered according to the target button scanning frequency, and the mouse button scanning status will be monitored to further ensure the normal operation of the mouse and avoid abnormal mouse response caused by adjusting the button scanning frequency.
[0142] Based on this, after triggering an interrupt according to the target key scanning frequency to perform key scanning according to the key scanning frequency, the method further includes:
[0143] Detect the button scanning status of the mouse;
[0144] If the key scan status is abnormal, obtain the key scan frequency for repair based on the type of abnormality.
[0145] Configure the interrupt period of the mouse's hardware timer according to the repaired button scanning frequency to restore the mouse's button scanning frequency to the repaired button scanning frequency.
[0146] Specifically, abnormal button scanning status refers to an abnormal response after configuring the target button scanning frequency on the mouse. This abnormality can be caused by frequency jitter or interruption during scanning, or by the button scanning task timeout. Therefore, based on the cause of the abnormality, abnormal button scanning status can be divided into interrupt triggering abnormalities and scanning task abnormalities. That is, the abnormality types of abnormal button scanning status can include interrupt triggering abnormalities and scanning task abnormalities. Interruption triggering abnormalities will cause frequency jitter or interruption dropping during scanning, while scanning task abnormalities indicate that the button scanning task timed out and did not respond.
[0147] Furthermore, the button scanning frequency can be fixed using the default button scanning frequency. This means the mouse has a pre-set button scanning frequency, and when an abnormal button scanning state occurs, the default frequency is used as the fix frequency to restore the mouse's button scanning frequency to the default. However, since different types of abnormalities have different causes, the fix frequency can be determined based on the type of abnormality. Specifically, when the abnormality is an interruption-triggered exception, the previous button scanning frequency can be retrieved and used as the fix frequency. When the abnormality is a scanning task exception, the scanning task can be re-executed, and the default button scanning frequency is used as the fix frequency when the number of failed scans reaches a preset number. This allows for different fix frequencies to be configured for different abnormality types, resolving button scanning state abnormalities caused by low button scanning frequency while allowing for a more user-friendly button scanning frequency configuration.
[0148] In summary, this embodiment provides a method for adjusting the mouse button scanning frequency. The method includes acquiring button scanning frequency parameters and determining a target button scanning frequency for the mouse based on the button scanning frequency parameters; dynamically configuring the interrupt period of the mouse button scanning according to the target button scanning frequency to adjust the mouse button scanning frequency to the target button scanning frequency; and triggering an interrupt according to the target button scanning frequency to perform button scanning at the target button scanning frequency. This application can dynamically configure the interrupt period of the mouse hardware timer based on the acquired scanning frequency parameters, thereby adjusting the mouse button scanning frequency. This allows users to dynamically adjust the mouse button scanning rate according to usage scenarios and needs, thereby providing optimal performance in different applications and solving the performance limitation problem caused by a fixed mouse button scanning rate in the prior art.
[0149] Based on the above-described mouse button scanning frequency adjustment method, this embodiment provides a mouse button scanning frequency adjustment device, such as... Figure 3 As shown, the mouse button scanning frequency adjustment device specifically includes:
[0150] The acquisition module 100 is used to acquire key scanning frequency parameters and determine the target key scanning frequency of the mouse based on the key scanning frequency parameters.
[0151] The configuration module 200 is used to dynamically configure the interrupt cycle of the mouse button scanning according to the target button scanning frequency, so as to adjust the mouse button scanning frequency to the target button scanning frequency.
[0152] The control module 300 is used to trigger an interrupt according to the target key scanning frequency so as to perform key scanning according to the key scanning frequency.
[0153] Based on the above-described mouse button scanning frequency adjustment method, this embodiment provides a computer-readable storage medium storing one or more programs, which can be executed by one or more processors to implement the steps in the mouse button scanning frequency adjustment method described in the above embodiment.
[0154] Based on the above-described mouse button scanning frequency adjustment method, this application also provides a mouse, such as... Figure 4 As shown, it includes at least one processor 20 and a memory 22, which can communicate with each other via a bus. The processor 20 can call logical instructions in the memory 22 to execute the methods in the above embodiments. The mouse may also include a communication interface that communicates with the processor 20 and the memory 22 via the bus to transmit information.
[0155] Furthermore, the logical instructions in the aforementioned memory 22 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.
[0156] The memory 22, as a computer-readable storage medium, can be configured to store software programs, computer-executable programs, such as program instructions or modules corresponding to the methods in the embodiments of this disclosure. The processor 20 executes functional applications and data processing by running the software programs, instructions, or modules stored in the memory 22, thereby implementing the methods in the above embodiments.
[0157] The memory 22 may include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a given function; the data storage area may store data created based on mouse usage, etc. Furthermore, the memory 22 may include high-speed random access memory (RAM) and non-volatile memory. Examples include various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks; these can also be transient storage media.
[0158] Furthermore, the specific process of loading and executing the aforementioned storage medium and the multiple instruction processors in the mouse has been described in detail in the above method, and will not be repeated here.
[0159] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A method for adjusting the scanning frequency of mouse buttons, characterized in that, The mouse button scanning frequency adjustment method specifically includes: Acquire button scanning frequency parameters and determine the target button scanning frequency of the mouse based on the button scanning frequency parameters, wherein the button scanning frequency parameters are acquired based on configuration instructions or based on device data; The interrupt cycle of the mouse button scanning is dynamically configured according to the target button scanning frequency, so as to adjust the mouse button scanning frequency to the target button scanning frequency. An interrupt is triggered based on the target key scanning frequency to perform key scanning at the stated key scanning frequency; The method further includes, before dynamically configuring the interrupt period of the mouse button scanning according to the target button scanning frequency to adjust the mouse button scanning frequency to the target button scanning frequency: The validity of the target key scanning frequency is verified. If the validity check passes, then the step of dynamically configuring the interrupt period of the mouse button scanning according to the target button scanning frequency is executed to adjust the mouse button scanning frequency to the target button scanning frequency. If the validity check fails, an adjustment failure message will be displayed.
2. The mouse button scanning frequency adjustment method according to claim 1, characterized in that, The specific steps of obtaining the key scan frequency parameters include: Receive configuration instructions sent by the host terminal to which the mouse is connected, wherein the configuration instructions include key scanning frequency parameters; The configuration instructions are parsed to obtain the key scanning frequency parameters.
3. The mouse button scanning frequency adjustment method according to claim 2, characterized in that, Before receiving the configuration command sent by the host terminal connected to the mouse, the method further includes: The host computer receives the key scanning frequency parameters input by the user through its display interface. Based on the key scanning frequency parameters, the configuration instructions are generated by the software driver layer in the host and sent to the mouse.
4. The mouse button scanning frequency adjustment method according to claim 2, characterized in that, Before receiving the configuration command sent by the host terminal connected to the mouse, the method further includes: The software driver layer in the host identifies the foreground application currently running on the host and determines the mouse button scanning frequency parameters based on the foreground application. Based on the key scanning frequency parameters, the configuration instructions are generated by the software driver layer in the host and sent to the mouse.
5. The mouse button scanning frequency adjustment method according to claim 2, characterized in that, After obtaining the key scanning frequency parameters and determining the target key scanning frequency of the mouse based on the key scanning frequency parameters, the method further includes: Obtain the current device status of the mouse; The target button scanning frequency is adjusted according to the current device status so that the target button scanning frequency is adapted to the device status of the mouse.
6. The mouse button scanning frequency adjustment method according to claim 1, characterized in that, The specific steps of obtaining the key scan frequency parameters include: Acquire device data for the mouse, wherein the device data includes historical usage information and / or current device status; The key scanning frequency parameters are determined based on the device data.
7. The mouse button scanning frequency adjustment method according to claim 6, characterized in that, The specific steps of determining the key scanning frequency parameters based on the device data include: If the device data includes historical usage information and current device status, then the first key scan frequency parameter is determined based on the historical usage information; Detect whether the current device status supports the first key scan frequency parameter; If the first key scan frequency parameter is supported, then the first key scan frequency parameter is used as the key scan frequency parameter. If the first key scan frequency parameter is not supported, then the second key scan frequency parameter is determined based on the current device status, and the key scan frequency parameter is used as the key scan frequency parameter.
8. The mouse button scanning frequency adjustment method according to claim 6, characterized in that, The historical usage information includes one or more of the following: the number of clicks within a preset time period, the distance traveled within a preset time period, and the difference in the number of clicks between two preset time periods. The current device status includes hardware resource usage and / or battery status.
9. The mouse button scanning frequency adjustment method according to claim 1, characterized in that, The key scanning frequency parameter is one of the following: target key scanning frequency, key scanning time interval, scanning mode, scanning frequency level and scanning frequency level adjustment amount, key scanning frequency adjustment amount, and key scanning time interval adjustment amount.
10. The mouse button scanning frequency adjustment method according to claim 1, characterized in that, After determining the target button scanning frequency of the mouse based on the button scanning frequency parameters, the method further includes: The target button scanning frequency is saved to the storage area of the mouse so that it can be read.
11. The mouse button scanning frequency adjustment method according to claim 1, characterized in that, The step of dynamically configuring the interrupt period of the mouse button scanning according to the target button scanning frequency to adjust the mouse button scanning frequency to the target button scanning frequency specifically includes: Read the current button scanning frequency of the mouse, and calculate the button scanning frequency difference between the target button scanning frequency and the current button scanning frequency; When the difference in the button scanning frequency is less than or equal to a preset difference threshold, the interrupt period of the mouse's hardware timer is configured according to the target button scanning frequency so as to adjust the mouse's button scanning frequency to the target button scanning frequency. When the difference between the button scanning frequencies is greater than the preset difference threshold, an intermediate button scanning frequency is configured between the current button scanning frequency and the target button scanning frequency based on the preset difference threshold. The intermediate button scanning frequency and the target button scanning frequency are then configured to the interrupt period of the mouse's hardware timer in ascending order of button scanning frequency, so as to adjust the mouse's button scanning frequency to the target button scanning frequency.
12. The mouse button scanning frequency adjustment method according to claim 1, characterized in that, After triggering an interrupt based on the target key scanning frequency to perform key scanning according to the key scanning frequency, the method further includes: Detect the button scanning status of the mouse; If the key scan status is abnormal, the key scan frequency for repair is obtained according to the type of abnormality, wherein the types of abnormality include interruption triggering abnormality and scan task abnormality; Configure the interrupt period of the mouse's hardware timer according to the repaired button scanning frequency to restore the mouse's button scanning frequency to the repaired button scanning frequency.
13. A mouse button scanning frequency adjustment device, characterized in that, The mouse button scanning frequency adjustment device specifically includes: The acquisition module is used to acquire key scanning frequency parameters and determine the target key scanning frequency of the mouse based on the key scanning frequency parameters, wherein the key scanning frequency parameters are acquired based on configuration instructions or based on device data. The configuration module is used to dynamically configure the interrupt cycle of the mouse button scanning according to the target button scanning frequency, so as to adjust the mouse button scanning frequency to the target button scanning frequency. The control module is used to trigger an interrupt according to the target key scanning frequency so as to perform key scanning according to the key scanning frequency; Before dynamically configuring the interrupt period of the mouse button scanning according to the target button scanning frequency to adjust the mouse button scanning frequency to the target button scanning frequency, the method further includes: The validity of the target key scanning frequency is verified. If the validity check passes, then the step of dynamically configuring the interrupt period of the mouse button scanning according to the target button scanning frequency is executed to adjust the mouse button scanning frequency to the target button scanning frequency. If the validity check fails, an adjustment failure message will be displayed.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, which can be executed by one or more processors to implement the steps in the mouse button scanning frequency adjustment method as described in any one of claims 1-12.
15. A mouse, characterized in that, include: Processor and memory; The memory stores a computer-readable program that can be executed by the processor; When the processor executes the computer-readable program, it implements the steps in the mouse button scanning frequency adjustment method as described in any one of claims 1-12.
Citation Information
Patent Citations
Keyboard scanning method and apparatus, computer device and storage medium
CN108595018A
Key scanning circuit, wake-up module and input device
CN222981529U