Mouse key scanning frequency adjusting method and 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 and personalized customization of the button scanning rate, thereby improving mouse performance and user experience in different applications.
Patent Information
- Application Number
- CN202511509951.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-22
- Publication Date
- 2025-11-21
- 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 the key scanning is performed by triggering an interrupt according to the target key scanning frequency, thereby realizing the 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 limitations caused by a fixed scan rate and improving user experience and flexibility.
Smart Images

Figure CN120994076A_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: Obtaining a key scanning frequency parameter, and determining a target key scanning frequency of the mouse according to the key scanning frequency parameter; 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; According to the target key scanning frequency, triggering the interrupt to perform key scanning according to the key scanning frequency.
[0006] The mouse key scanning frequency adjusting method, wherein the obtaining of the key scanning frequency parameter specifically comprises: Receiving a configuration instruction sent by a host end connected with the mouse, wherein the configuration instruction contains a key scanning frequency parameter; Parsing the configuration instruction to obtain the key scanning frequency parameter.
[0007] The mouse key scanning frequency adjusting method, wherein before the receiving of the configuration instruction sent by the host end connected with the mouse, the method further comprises: receiving a key scanning frequency parameter input by a user through a display interface of the host end; 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.
[0008] The mouse key scanning frequency adjustment method, wherein, before receiving the configuration instruction sent by the host end to which the mouse is connected, the method further comprises: 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; 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.
[0009] The mouse key scanning frequency adjustment method, wherein, after obtaining the key scanning frequency parameter and determining the target key scanning frequency of the mouse according to the key scanning frequency parameter, the method further comprises: obtaining a current device state of the mouse; 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.
[0010] The mouse key scanning frequency adjustment method, wherein, the obtaining of the key scanning frequency parameter specifically comprises: obtaining device data of the mouse, wherein the device data comprises historical use information and / or a current device state; determining the key scanning frequency parameter according to the device data.
[0011] The mouse key scanning frequency adjustment method, wherein, the determining of the key scanning frequency parameter according to the device data specifically comprises: 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; detecting whether the current device state supports the first key scanning frequency parameter; if the first key scanning frequency parameter is supported, taking the first key scanning frequency parameter as the key scanning frequency parameter; if the first key scanning frequency parameter is not supported, determining a second key scanning frequency parameter according to the current device state, and taking the key scanning frequency parameter as the key scanning frequency parameter.
[0012] The mouse key scanning frequency adjustment method, wherein the historical use information comprises one or more of a click number in a preset time period, a moving distance in a preset time period, and a click number difference between two preset time periods, and the current device state comprises a hardware resource usage and / or a battery state.
[0013] The mouse key scanning frequency adjustment method, wherein the key scanning frequency parameter is one of a target key scanning frequency, a key scanning time interval, a scanning mode, a scanning frequency gear and a scanning frequency gear adjustment amount, a key scanning frequency adjustment amount, and a key scanning time interval adjustment amount.
[0014] The mouse key scanning frequency adjustment method, wherein after determining the target key scanning frequency of the mouse according to the key scanning frequency parameter, the method further comprises: saving the target key scanning frequency to a storage area of the mouse, so as to read the target key scanning frequency from the storage area of the mouse.
[0015] The mouse key scanning frequency adjustment method, wherein before dynamically configuring the interrupt period of the mouse key scanning according to the target key scanning frequency to adjust the key scanning frequency of the mouse to the target key scanning frequency, the method further comprises: validating the target key scanning frequency; if the validation is passed, performing the step of dynamically configuring the interrupt period of the mouse key scanning according to the target key scanning frequency to adjust the key scanning frequency of the mouse to the target key scanning frequency; if the validation is not passed, prompting an adjustment failure.
[0016] The mouse key scanning frequency adjustment method, wherein dynamically configuring the interrupt period of the mouse key scanning according to the target key scanning frequency to adjust the key scanning frequency of the mouse to the target key scanning frequency specifically comprises: reading a current key scanning frequency of the mouse and calculating a key scanning frequency difference between the target key scanning frequency and the current key scanning frequency; when the key scanning frequency difference is less than or equal to a preset difference threshold, configuring an interrupt period of a hardware timer of the mouse according to the target key scanning frequency to adjust the key scanning frequency of the mouse to the target key scanning frequency; When the key scanning frequency difference is greater than the preset difference threshold, an intermediate key scanning frequency is configured between the current key scanning frequency and the target key scanning frequency according to the preset difference threshold, and the intermediate key scanning frequency and the target key scanning frequency are sequentially configured to the interrupt period of the hardware timer of the mouse in the order of the key scanning frequency from small to large, so as to adjust the key scanning frequency of the mouse to the target key scanning frequency.
[0017] The mouse key scanning frequency adjustment method, wherein after the interrupt is triggered according to the target key scanning frequency to perform key scanning according to the key scanning frequency, the method further comprises: detecting a key scanning state of the mouse; if the key scanning state is abnormal, obtaining a repair key scanning frequency according to an abnormal type, wherein the abnormal type comprises an interrupt triggering abnormality and a scanning task abnormality; configuring the interrupt period of the hardware timer of the mouse according to the repair key scanning frequency, so as to restore the key scanning frequency of the mouse to the repair key scanning frequency.
[0018] The second aspect of the present application provides a mouse key scanning frequency adjustment device, wherein the mouse key scanning frequency adjustment device specifically comprises: an obtaining module, configured to obtain a key scanning frequency parameter, and determine a target key scanning frequency of a mouse according to the key scanning frequency parameter; a configuration module, configured to dynamically configure an interrupt period of key scanning of the mouse according to the target key scanning frequency, so as to adjust the key scanning frequency of the mouse to the target key scanning frequency; a control module, configured to trigger an interrupt according to the target key scanning frequency to perform key scanning according to the key scanning frequency.
[0019] The third aspect of the present application provides a computer readable storage medium, the computer readable storage medium stores one or more programs, the one or more programs can be executed by one or more processors to implement the steps in the mouse key scanning frequency adjustment method as any of the above.
[0020] The fourth aspect of the present application provides a mouse, comprising: a processor and a memory; the memory stores a computer readable program which can be executed by the processor; the processor executes the computer readable program to implement the steps in the mouse key scanning frequency adjustment method as any of the above.
[0021] Beneficial effects: compared with the prior art, the application provides a mouse key scanning frequency adjustment method, device, equipment and medium, the method comprises: acquiring a key scanning frequency parameter, and determining a target key scanning frequency of a mouse according to the key scanning frequency parameter; dynamically configuring an interrupt period of the mouse key scanning according to the target key scanning frequency, so as to adjust the key scanning frequency of the mouse to the target key scanning frequency; triggering an interrupt according to the target key scanning frequency to perform key scanning according to the key scanning frequency. The application can dynamically configure the interrupt period of the mouse hardware timer according to the acquired scanning frequency parameter, so as to adjust the key scanning frequency of the mouse. In this way, the user can dynamically adjust the mouse key scanning rate according to the use scene and demand, so as to provide the best performance in different applications, and solve the performance limitation problem caused by the fixed mouse key scanning rate in the prior art. BRIEF DESCRIPTION OF DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the application, the drawings needed to be used in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.
[0023] Figure 1 The flow chart of the mouse key scanning frequency adjustment method provided by the embodiments of the application.
[0024] Figure 2 The timing diagram of one implementation mode of the mouse key scanning frequency adjustment method provided by the embodiments of the application.
[0025] Figure 3 The principle block diagram of the mouse key scanning frequency adjustment device provided by the embodiments of the application.
[0026] Figure 4 The principle block diagram of the mouse provided by the embodiments of the application. DETAILED DESCRIPTION
[0027] The embodiments of the application provide a mouse key scanning frequency adjustment method, device, equipment and medium. In order to make the purpose, technical scheme and effect of the application more clear and explicit, the application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the application, and are not used to limit the application.
[0028] It is to be understood that the singular forms "a," "an," and "the" include plural referents unless the context clearly dictates otherwise. It is further understood that the terms "comprise" (or comprise), "comprises" (or comprises) and "comprising" (or comprising) when used in this specification, specify the presence of stated features, integers, steps, operations, elements, or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, or groups thereof. It is further understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements can be present. In addition, the use of "connection" or "coupling" herein also includes wireless connection or wireless coupling. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0029] It is to be understood that the terms used herein are not intended to limit the present application to the precise formulations and implementation illustrated, but rather, the terms are intended to include all technical equivalents which operate similarly to the ones described herein and which are commensurate with the intended scope of the present application. Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
[0030] It is to be understood that the sequence of the steps and the size in the embodiments are not intended to mean the order of execution, and the execution order of the processes is determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0031] It is found through research that the mouse on the market mainly allows users to adjust two core parameters: DPI (Dots Per Inch): refers to the resolution of the optical sensor, which affects the speed of the cursor moving on the screen.
[0032] Return rate (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 and response delay of the cursor movement.
[0033] However, from the time the user presses the physical button to the time the computer receives the click signal, there is a key and long-term ignored link by all mouse manufacturers - button scanning, and the corresponding parameter of the link is the button scanning rate. The button scanning rate refers to the frequency at which the mouse master MCU (Micro Control Unit) detects whether the physical button (such as the left button, the right button, the side button, etc.) is in the pressed state. High scanning rate means that the MCU can detect the action faster after the button is pressed, thereby reducing the click delay.
[0034] The prior art mouse, the key scanning rate is usually preset as a fixed value at the time of firmware development and written in the code of MCU, and the user cannot change it according to the use scene and demand. This leads to the following problems: 1. Lack of flexibility: fixed high scanning rate will increase the power consumption of MCU in unnecessary scenarios; fixed low scanning rate cannot meet the high demand scenarios such as e-sports.
[0035] 2. Single user experience: users cannot customize the response characteristics of the mouse.
[0036] 3. Difficulty in upgrading iteration: if you want to change the scanning rate, you must reprogram the firmware, which is difficult for ordinary users to achieve.
[0037] Therefore, the embodiments of the present application provide a mouse key scanning frequency adjustment method, the method comprises: obtaining a key scanning frequency parameter, and determining a target key scanning frequency of the mouse according to the key scanning frequency parameter; dynamically configuring the interrupt period of the mouse key scanning according to the target key scanning frequency, so as to adjust the key scanning frequency of the mouse to the target key scanning frequency; triggering an interrupt according to the target key scanning frequency to perform key scanning according to the key scanning frequency. The present application can dynamically configure the interrupt period of the mouse hardware timer according to the obtained scanning frequency parameter, so as to adjust the key scanning frequency of the mouse. In this way, the user can dynamically adjust the mouse key scanning rate according to the use scene and demand, so as to provide the best performance in different applications, not only solving the performance limitation problem caused by the fixed mouse key scanning rate in the prior art, but also allowing the user to customize the response characteristics of the mouse, which brings convenience to the user.
[0038] The application content will be further described by describing the embodiments in combination with the drawings.
[0039] The embodiments provide a mouse key scanning frequency adjustment method, as shown in Figure 1 The method specifically comprises: S10, obtaining a key scanning frequency parameter, and determining a target key scanning frequency of the mouse according to the key scanning frequency parameter.
[0040] Specifically, the scan frequency parameter is the basis for adjusting the key scan frequency of the mouse. According to the scan frequency parameter, the adjusted key scan frequency (i.e., the target key scan frequency) can be determined. The scan frequency parameter is one of the target key scan frequency, the key scan time interval (i.e., the time interval between two times of reading the key value IO state by the mouse MCU), the scan mode, the scan frequency gear and the scan frequency gear adjustment amount, the key scan frequency adjustment amount, and the key scan time interval adjustment amount. The target key scan frequency is the adjusted key scan frequency of the mouse, which is determined according to the key scan frequency parameter and stored in the storage area (such as EEPROM or Flash) of the mouse. That is, the mouse stores the key scan frequency in the storage area, so that the target key scan frequency can be stored in the storage area of the mouse to read the target key scan frequency from the storage area of the mouse.
[0041] Based on this, after determining the target key scan frequency of the mouse according to the key scan frequency parameter, the method further includes saving the target key scan frequency to the storage area of the mouse, so as to read the target key scan frequency from the storage area of the mouse. The storage area can store one or more key scan frequencies, and each key scan frequency stored in the storage area has a storage time, so that when the mouse is abnormally adjusted due to the abnormal key scan frequency parameter, the scan frequency parameter can be obtained from the storage area according to the storage time.
[0042] Further, the key scan frequency parameter is one of the target key scan frequency, the key scan time interval, the scan mode, the scan frequency gear and the scan frequency gear adjustment amount, the key scan frequency adjustment amount, and the key scan time interval adjustment amount. The process of determining the target key scan frequency of the mouse according to the key scan frequency parameter can be: If the key scan frequency parameter is the key scan frequency, the key scan frequency is taken as the target key scan frequency; If the key scan frequency parameter is the key scan time interval, the target key scan frequency is determined according to the correspondence between the key scan time interval and the key scan frequency (e.g., the key scan frequency is 1000 Hz, the key scan interval time is 1 ms; the key scan frequency is 2000 Hz, the key scan interval time is 0.5 ms; the key scan frequency is 8000 Hz, the key scan interval time is 0.125 ms, etc.); If the key scan frequency parameter is the scan mode, the target key scan frequency is determined according to the preset correspondence between the scan mode and the key scan frequency (e.g., the scan model is the office model, the key scan frequency is 1000 Hz; the scan model is the game model, the key scan frequency is 8000 Hz, etc.); If the key scan frequency parameter is a scan frequency level, the target key scan frequency is determined according to the preset correspondence between the scan frequency level and the key scan frequency (for example, the scan frequency level is 1 level, the key scan frequency is 1000 Hz; the scan frequency level is 2 level, the key scan frequency is 2000 Hz; the scan frequency level is 8 level, the key scan frequency is 8000 Hz, etc.). If the key scan frequency parameter is a scan frequency level adjustment amount, the current scan frequency level is obtained, and the target scan frequency level is determined according to the current scan frequency level and the scan frequency level adjustment amount, and then the target key scan frequency is determined according to the preset correspondence between the scan frequency level and the key scan frequency. If the key scan frequency parameter is a key scan frequency adjustment amount, the current key scan frequency is obtained, and the target key scan frequency is determined according to the current key scan frequency and the key scan frequency adjustment amount. If the key scan frequency parameter is a key scan time interval adjustment amount, the current key scan time interval is obtained, and the target scan time interval is calculated according to the current key scan time interval and the key scan time interval adjustment amount, and then the key scan frequency per unit time is calculated according to the target key scan time interval to obtain the target key scan frequency.
[0043] In one embodiment, the obtaining of the key scan frequency parameter specifically includes: receiving a configuration instruction sent by a host end to which the mouse is connected; parsing the configuration instruction to obtain the key scan frequency parameter.
[0044] Specifically, the configuration instruction is sent by the host end to the mouse to inform the mouse to adjust the key scan frequency according to the key scan frequency parameter in the configuration instruction, that is, the configuration instruction contains the key scan frequency parameter. After receiving the configuration instruction, the mouse can first verify the configuration instruction, and parse the configuration instruction to obtain the key scan frequency parameter after the verification is passed. The verification can include modification authority verification and / or device identification verification. The modification authority verification is used to verify whether the host end has the key scan frequency parameter adjustment authority, and the device identification verification is used to verify the legality of the device of the host end.
[0045] Further, since the configuration instruction is sent by the host to the mouse, the host will generate the configuration instruction and send it to the mouse before the mouse receives the configuration instruction. That is, before receiving the configuration instruction sent by the host to which the mouse is connected, the method further includes a configuration instruction generation process for generating the configuration instruction and sending it to the mouse. The configuration instruction can be generated by the host according to user instructions, automatically generated by the host according to its own running condition, or generated by the host according to user instructions and its own running condition, etc. Two specific implementation manners of generating the configuration instruction are given.
[0046] In one specific implementation manner, before receiving the configuration instruction sent by the host to which the mouse is connected, the method further includes: receiving a key scanning frequency parameter input by a user through a display interface of the host; generating the configuration instruction based on the key scanning frequency parameter through a software driver layer in the host, and sending the configuration instruction to the mouse.
[0047] Specifically, as shown in Figure 2 The user can input the key scanning frequency parameter on the display interface of the host, where the key scanning frequency parameter can be directly input by the user through voice or text, or input by performing a selection operation on the key scanning frequency parameter displayed on the display interface, or input by triggering a preset key scanning frequency key, etc.
[0048] After the user inputs the key scanning frequency parameter, the key scanning frequency parameter is transmitted to the software driver layer in the host, which generates the configuration instruction based on the key scanning frequency parameter and carries the key scanning frequency parameter as instruction information of the configuration instruction. Then, the software driver layer of the host sends the configuration instruction to the mouse through the connection mode between the host and the mouse, for example, when the mouse is connected to the host through USB, the software driver layer of the host sends the configuration instruction to the mouse through USB, when the mouse is connected to the host through Bluetooth or other wireless communication mode, the software driver layer of the host sends the configuration instruction to the mouse through Bluetooth or other wireless communication mode, etc.
[0049] In another specific implementation manner, before receiving the configuration instruction sent by the host to which the mouse is connected, the method further includes: identifying a foreground application currently running in the host through the software driver layer in the host, and determining the key scanning frequency parameter of the mouse according to the foreground application; Based on the key scanning frequency parameter, the configuration instruction is generated by a software driver layer in the host end, and the configuration instruction is sent to the mouse.
[0050] Specifically, the foreground application refers to an application running in the foreground at the current time, for example, an office application, a game application, etc. After obtaining the currently running foreground application, it can be detected whether the currently running foreground application and the foreground application running at the previous time have changed. If there is a change, the key scanning frequency parameter of the mouse is determined according to the foreground application. If there is no change, the host end continues to identify the currently running foreground application.
[0051] Further, when the key scanning frequency parameter of the mouse is determined according to the foreground application, the program type of the foreground application can be obtained, and then the key scanning frequency parameter of the mouse is determined according to the correspondence between the program type and the key scanning frequency. The program type can include an office program type, a game program type, and a video program type. The program type can be preset by the driving software or defined by the user. If the currently running foreground application is a game program type, the key scanning frequency corresponding to the game program type can be read, and the key scanning frequency parameter is determined according to the key scanning frequency corresponding to the game program type. For example, if the currently running program is an XX game program, the key scanning frequency corresponding to the game program type is set as 8000Hz to improve the response speed of the mouse; if the currently running program is an XX office program, the key scanning frequency corresponding to the office program type is set as 1000Hz to save the energy consumption of the mouse.
[0052] It should be noted that, in order to avoid the accuracy of the key scanning frequency adjustment, after identifying the currently running foreground application, it can be detected 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 instruction is generated), and if the program types are different, the key scanning frequency parameter of the mouse is determined according to the foreground application.
[0053] Of course, in actual application, when determining the key scan frequency parameter of the mouse according to the foreground application, it can also be judged whether the key scan frequency corresponding to the foreground application is pre-configured, if pre-configured, the key scan frequency parameter is determined according to the foreground application, if not pre-configured, the program type of the foreground application is obtained, so that the user can set the specified key scan frequency according to the demand. For example, user A is a player of XX game, when user A uses XX game application, the key scan frequency of the mouse can be directly configured as the fixed scan frequency of user A using the XX game application, so that the user can more accurately predict the mouse response time.
[0054] In one embodiment, since the key scan frequency parameter is sent to the mouse by the host, especially when the key scan frequency parameter is set by the user, the target key scan frequency determined according to the key scan frequency parameter may not be suitable for the mouse, which may cause abnormal response of the mouse. Therefore, after obtaining the target key scan frequency, the target key scan frequency can be adjusted to make the adjusted target key scan frequency suitable for the mouse. Based on this, after obtaining the key scan frequency parameter and determining the target key scan frequency of the mouse according to the key scan frequency parameter, the method further comprises: obtaining the current device state of the mouse; adjusting the target key scan frequency according to the current device state, so that the target key scan frequency is suitable for the device state of the mouse.
[0055] Specifically, the current device state is used to reflect the use state of the mouse, wherein the current device state can include hardware resource usage and / or battery state. That is, after determining the target key scan frequency of the mouse, the target key scan frequency can be adjusted by using the current device state, and the adjustment process can be: obtaining the required hardware resources and / or power consumption of the target key scan frequency; then detecting whether the current device state meets the required hardware resources and / or power consumption of the target key scan frequency, if it meets, keeping the target key scan frequency unchanged, if it does not meet, adjusting the target key scan frequency according to the current device state to make the current device state meet the required hardware resources and / or power consumption of the target key scan frequency. Wherein, meeting the required hardware resources means that the free hardware resources of the mouse are greater than or equal to the required hardware resources, and meeting the power consumption means that the remaining battery capacity can meet the use of the mouse for at least a predetermined time (for example, 1 hour, etc.) under the power consumption.
[0056] It should be noted that when the current device state includes hardware resource usage, only whether the required hardware resource is met is detected, when the current device state includes battery state, only whether the power consumption is met is detected, and when the current device state includes hardware resource usage and battery state, whether the required hardware resource is met and whether the power consumption is met are simultaneously detected.
[0057] After determining the target key scanning frequency, the target key scanning frequency is adjusted based on the current device state of the mouse, so that the adjusted target key scanning frequency can balance between performance and power consumption, and reasonably meet the user demand.
[0058] The above is an example of obtaining the key scanning frequency parameter through the host end. However, in actual application, in addition to the host end controlling the mouse to adjust the key scanning frequency, the mouse can automatically adjust the key scanning frequency, that is, the mouse can obtain the key scanning frequency parameter by itself without the participation of the host end, and determine the target key scanning frequency based on the key scanning frequency parameter. Therefore, the process of the mouse obtaining the key scanning frequency parameter by itself without the participation of the host end is described below.
[0059] In one embodiment, the obtaining the key scanning frequency parameter specifically includes: obtaining device data of the mouse; determining the key scanning frequency parameter according to the device data.
[0060] Specifically, the device data includes historical usage information and / or current device state, the historical usage information includes one or more of the number of clicks in a preset time period, the moving distance in a preset time period, and the difference in the number of clicks in two preset time periods, and the current device state includes hardware resource usage and / or battery state. Wherein, the preset time period can be a preset time period before the current time, so that the mouse can adjust the key scanning frequency in real time according to its own usage; or it can be the running time period of the host end before the last running of the foreground application currently running, so that the mouse can automatically adjust the key scanning frequency according to the foreground application running by the host end.
[0061] When determining the key scanning frequency parameter according to the device data, the key scanning frequency parameter can be directly obtained according to the preset correspondence between the device data and the key scanning frequency parameter, or the obtained device data can include data information items (i.e. historical usage information, current device state), then the key scanning frequency parameter corresponding to each data information item is obtained, and one is selected from all the obtained key scanning frequency parameters; or the data information items in the device data can be configured with priorities, and the key scanning frequency parameter corresponding to the data information item with the highest priority is selected.
[0062] In one specific implementation, the determining the key scan frequency parameter according to the device data specifically comprises: If the device data comprises historical usage information and current device state, determining a first key scan frequency parameter according to the historical usage information; detecting whether the current device state supports the first key scan frequency parameter; If the first key scan frequency parameter is supported, the first key scan frequency parameter is taken as the key scan frequency parameter; If the first key scan frequency parameter is not supported, determining a second key scan frequency parameter according to the current device state, and taking the key scan frequency parameter as the key scan frequency parameter.
[0063] Specifically, the first key scan frequency parameter is determined according to the historical usage information, and the determination process can be that the historical usage information is input into a preset prediction model, the first key scan frequency parameter is output through the preset prediction model, or the first key scan frequency parameter is directly determined according to a preset corresponding relationship between the historical usage information and the key scan frequency. Wherein, the determination process of determining the first key scan frequency parameter according to the historical usage information can be: When the historical usage information comprises the number of clicks in a preset time period, the first key scan frequency is determined according to a preset corresponding relationship between the number of clicks and the key scan frequency, and the preset number of clicks is proportional to the key scan frequency, so that the key scan frequency of the mouse matches the user activity intensity; When the historical usage information comprises the moving distance in a preset time period, the first key scan frequency is determined according to a preset corresponding relationship between the moving distance in a preset time period and the key scan frequency, so that the key scan frequency of the mouse matches the user activity intensity; When the historical usage information comprises the difference between the number of clicks in two preset time periods, the key scan frequency adjustment amount is determined according to the difference between the number of clicks in two preset time periods, and then the first key scan frequency is determined according to the key scan frequency adjustment amount, so that the key scan frequency of the mouse matches the user activity intensity; When the historical usage information comprises at least two of the number of clicks in a preset time period, the moving distance in a preset time period and the difference between the number of clicks in two preset time periods, the key scan frequency corresponding to each historical usage information item is obtained, and then each obtained key scan frequency can be weighted according to the weighting coefficient corresponding to each historical usage information item to obtain the first key scan frequency, wherein the weighting coefficient can be preset or determined according to the program type of the foreground running program.
[0064] After the first key scan frequency parameter is acquired, it can be detected whether the current device state supports the first key scan frequency parameter. The detection process can be: acquiring the hardware resource and / or power consumption required by the target key scan frequency; then detecting whether the current device state meets the required hardware resource and / or power consumption of the target key scan frequency. If it meets, it is directly determined to support the first key scan frequency parameter; if it does not meet, it is determined not to support the first key scan frequency parameter. Wherein, meeting the required hardware resource means that the free hardware resource of the mouse is greater than the required hardware resource, and meeting the power consumption means that the remaining battery power can meet the use of the mouse under the power consumption for at least a predetermined time (for example, 1 hour, etc.).
[0065] It should be noted that when the current device state includes hardware resource usage, only whether the required hardware resource is met is detected. When the current device state includes the battery state, only whether the power consumption is met is detected. When the current device state includes both the hardware resource usage and the battery state, whether the required hardware resource is met and whether the power consumption is met are detected simultaneously.
[0066] Further, when the first key scan frequency parameter is not supported, the second key scan frequency parameter is determined according to the current device state. Wherein, the determination process of the second key scan frequency parameter is to acquire a set of key scan frequency parameters supported by the current device state, and then select the key scan frequency parameter closest to the first key scan frequency parameter in the set of key scan frequency parameters as the second key scan frequency parameter. In this way, the key scan frequency that meets the current device state and best meets the user's use demand can be set as the target key scan frequency, which maximizes the convenience for the user.
[0067] S20, dynamically configure the interrupt period of the mouse key scan according to the target key scan frequency, so as to adjust the key scan frequency of the mouse to the target key scan frequency.
[0068] Specifically, the interrupt period of mouse key scanning is used to control the mouse to trigger the key scanning program at a fixed and periodic time interval (e.g., once every 10 ms) so that the triggering frequency of the key scanning program is the target key scanning frequency. The interrupt period of mouse key scanning can be managed by a hardware timer interrupt. To this end, in one specific implementation, the interrupt period of mouse key scanning can be achieved by configuring the interrupt period of a hardware timer, where the interrupt period of the hardware timer is the time elapsed from the start of the timer counter counting from an initial value (or an automatic reload value) to the generation of an interrupt request when the target value (usually 0 or the reload value) is reached, and the timer clock source frequency is the target key scanning frequency. That is, the timer clock source frequency is set to the target key scanning frequency, then the number of times the counter needs to count is calculated according to the timer clock source frequency, and finally the interrupt period of the hardware timer is calculated according to the number of times the counter needs to count.
[0069] Further, since the mouse is generally provided with an upper limit value of the key scanning frequency (e.g., 8000 Hz, etc.) and a lower limit value of the key scanning frequency (e.g., 100 Hz, etc.), the target key scanning frequency can also be checked before the interrupt period of mouse key scanning is dynamically configured according to the target key scanning frequency, to avoid the problem of target key scanning frequency overflow. Based on this, before the interrupt period of mouse key scanning is dynamically configured according to the target key scanning frequency to adjust the key scanning frequency of the mouse to the target key scanning frequency, the method further comprises: validating the effectiveness of the target key scanning frequency; if the effectiveness validation passes, performing the step of dynamically configuring the interrupt period of mouse key scanning according to the target key scanning frequency to adjust the key scanning frequency of the mouse to the target key scanning frequency; if the effectiveness validation fails, prompting adjustment failure.
[0070] Specifically, the effectiveness validation is used to check whether the target key scanning frequency is a key scanning frequency supported by the mouse, i.e., to detect whether the target key scanning frequency is between the upper limit value of the key scanning frequency and the lower limit value of the key scanning frequency, and when the target key scanning frequency is between the upper limit value of the key scanning frequency and the lower limit value of the key scanning frequency, it is determined that the effectiveness validation passes; otherwise, when the target key scanning frequency is not between the upper limit value of the key scanning frequency and the lower limit value of the key scanning frequency, it is determined that the effectiveness validation fails.
[0071] In one embodiment, the dynamically configuring the interrupt period of mouse key scanning according to the target key scanning frequency to adjust the key scanning frequency of the mouse to the target key scanning frequency specifically comprises: reading a current key scanning frequency of the mouse, and calculating a key scanning frequency difference between the target key scanning frequency and the current key scanning frequency; when the key scanning frequency difference is less than or equal to a preset difference threshold, configuring an interrupt period of a hardware timer of the mouse according to the target key scanning frequency, so as to adjust the key scanning frequency of the mouse to the target key scanning frequency; when the key scanning frequency difference is greater than the preset difference threshold, configuring an intermediate key scanning frequency between the current key scanning frequency and the target key scanning frequency according to the preset difference threshold, and configuring the interrupt period of the hardware timer of the mouse according to the intermediate key scanning frequency and the target key scanning frequency in order of the key scanning frequency from small to large, so as to adjust the key scanning frequency of the mouse to the target key scanning frequency.
[0072] Specifically, the preset difference threshold is pre-set to ensure the smoothness of the key scanning frequency. That is, when the key scanning frequency difference is greater than the preset difference threshold, directly setting the key scanning frequency of the mouse to the target key scanning frequency will cause the user to feel that the mouse response is lagging. Therefore, when the key scanning frequency difference is greater than the preset difference threshold, an asymptotic adjustment strategy can be used to gradually approach the target key scanning frequency. The asymptotic adjustment strategy is specifically: configuring an intermediate key scanning frequency between the current key scanning frequency and the target key scanning frequency according to the preset difference threshold, and when the intermediate key scanning frequency and the target key scanning frequency are arranged in order from small to large, the key scanning frequency difference between any two adjacent key scanning frequencies is less than or equal to the preset difference threshold.
[0073] After obtaining the intermediate key scanning frequency, the interrupt period of the hardware timer of the mouse is configured according to the intermediate key scanning frequency and the target key scanning frequency in order from small to large, so that the interrupt period of the hardware timer gradually approaches the interrupt period corresponding to the target key scanning frequency. In this way, not only can the key scanning frequency of the mouse be adjusted to the target key scanning frequency, but also the smoothness of the adjustment process can be ensured.
[0074] S30, triggering an interrupt according to the target key scanning frequency to perform key scanning according to the key scanning frequency.
[0075] Specifically, after the target key scanning frequency is adjusted to the key scanning frequency of the mouse, the interrupt will be triggered according to the target key scanning frequency, and the key scanning state of the mouse will be monitored to further ensure the normal operation of the mouse and avoid abnormal mouse response caused by adjusting the key scanning frequency.
[0076] Based on this, after the target key scanning frequency triggers an interrupt to perform key scanning at the key scanning frequency, the method further comprises: detecting a key scanning state of the mouse; if the key scanning state is abnormal, obtaining a repair key scanning frequency according to an abnormal type; configuring an interrupt period of a hardware timer of the mouse according to the repair key scanning frequency to restore the key scanning frequency of the mouse to the repair key scanning frequency.
[0077] Specifically, the key scanning state abnormality refers to a response abnormality of the mouse after the target key scanning frequency is configured. The abnormality can be caused by frequency jitter or interrupt loss during scanning, or can be caused by a key scanning task timeout without response. Therefore, the key scanning state abnormality can be divided into an interrupt trigger abnormality and a scanning task abnormality according to the cause of the abnormality, that is, the abnormal type of the key scanning state abnormality can include the interrupt trigger abnormality and the scanning task abnormality. The interrupt trigger abnormality will have frequency jitter or interrupt loss during scanning, and the scanning task abnormality indicates that the key scanning task times out without response.
[0078] Further, the repair key scanning frequency can be a default key scanning frequency, that is, the mouse is pre-configured with a key scanning frequency. When the key scanning state is abnormal, the default key scanning frequency is directly used as the repair key scanning frequency to restore the key scanning frequency of the mouse to the default key scanning frequency. However, since different abnormal types have different causes, the repair key scanning frequency can be obtained according to the abnormal type. Specifically, when the abnormal type is the interrupt trigger abnormality, the previous key scanning frequency of the current key scanning frequency can be obtained, and the previous key scanning frequency is used as the repair key scanning frequency. When the abnormal type is the scanning task abnormality, the scanning task can be re-executed, and when the number of scanning task execution failures reaches a preset number, the default key scanning frequency is used as the repair key scanning frequency. In this way, different repair key scanning frequencies can be configured for different abnormal types, which can solve the key scanning state abnormality of the mouse caused by the key scanning frequency, and can configure a key scanning frequency that is more suitable for user needs for the mouse.
[0079] In summary, the embodiment provides a mouse key scanning frequency adjusting method, which comprises obtaining a key scanning frequency parameter, and determining a target key scanning frequency of a mouse according to the key scanning frequency parameter; dynamically configuring an interrupt period of the mouse key scanning according to the target key scanning frequency, so as to adjust the key scanning frequency of the mouse to the target key scanning frequency; and triggering an interrupt according to the target key scanning frequency, so as to perform key scanning at the key scanning frequency. The application can dynamically configure the interrupt period of the mouse hardware timer according to the obtained scanning frequency parameter, so as to adjust the key scanning frequency of the mouse. In this way, the user can dynamically adjust the mouse key scanning rate according to the use scene and requirement, so as to provide the best performance in different applications, and solve the performance limitation problem caused by the fixed mouse key scanning rate in the prior art.
[0080] Based on the mouse key scanning frequency adjusting method, the embodiment provides a mouse key scanning frequency adjusting device, as shown in Figure 3 The mouse key scanning frequency adjusting device specifically comprises: an obtaining module 100, configured to obtain a key scanning frequency parameter, and determine a target key scanning frequency of a mouse according to the key scanning frequency parameter; a configuring module 200, configured to dynamically configure an interrupt period of the mouse key scanning according to the target key scanning frequency, so as to adjust the key scanning frequency of the mouse to the target key scanning frequency; a control module 300, configured to trigger an interrupt according to the target key scanning frequency, so as to perform key scanning at the key scanning frequency.
[0081] Based on the mouse key scanning frequency adjusting method, the embodiment provides a computer readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the mouse key scanning frequency adjusting method.
[0082] Based on the mouse key scanning frequency adjusting method, the application further provides a mouse, as shown in Figure 4 which comprises at least one processor 20 and a memory 22, and the processor 20 and the memory 22 can communicate with each other through a bus. The processor 20 can invoke the logic instructions in the memory 22 to execute the method in the above embodiment. The mouse can further comprise a communication interface, which communicates with the processor 20 and the memory 22 through the bus, so as to transmit information through the communication interface.
[0083] In addition, the logic instructions in the memory 22 described above can be implemented in the form of software function units and sold or used as independent products, and can be stored in a computer readable storage medium.
[0084] 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 method in the embodiments of the present disclosure. The processor 20 executes the software programs, instructions or modules stored in the memory 22, thereby performing functional applications and data processing, that is, implementing the method in the above embodiments.
[0085] The memory 22 can include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application required by a function; the data storage area can store data created according to the use of the mouse, etc. In addition, the memory 22 can include a high-speed random access memory, and can also include a non-volatile memory. For example, a variety of media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc. can also be a transient storage medium.
[0086] In addition, the specific processes of the plurality of instructions in the storage medium and the mouse loaded and executed by the processor have been described in detail in the above method, and will not be described one by one here.
[0087] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present 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: Obtain the button scanning frequency parameters, and determine the target button scanning frequency of the mouse based on the button scanning frequency parameters; The interrupt cycle of the mouse button scanning is dynamically configured according to the target button scanning frequency in order to adjust the mouse button scanning frequency to the target button scanning frequency. An interrupt is triggered based on the target key scan frequency to perform key scanning at the stated key scan frequency.
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 scanning frequency parameter is supported, then the first key scanning frequency parameter is used as the key scanning 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, 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.
12. The mouse button scanning frequency adjustment method according to claim 1 or 11, 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 in order 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.
13. 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.
14. 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. 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.
15. 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-13.
16. 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-13.
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
Keyboard Assembly
US20190094984A1