A keyboard ghost key processing method and device and a keyboard
By analyzing the continuous detection window of the keyboard and matching it with a preset whitelist, ghost keys are identified and processed, solving the misjudgment problem of low-end keyboards when multiple keys are pressed, and improving the accuracy and compatibility of ghost key processing.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ANHUI SHENGYUN INTELLIGENT TECH CO LTD
- Filing Date
- 2026-03-20
- Publication Date
- 2026-06-23
AI Technical Summary
Low-end keyboards face the problem of ghost keys, which existing technologies struggle to handle effectively, especially when multiple keys are pressed simultaneously, leading to misjudgments.
By acquiring the detected key values of the current window and the previous window of the keyboard, analyzing the difference in the number of keys, and using the key value counts of two consecutive detection windows, ghost keys are identified and processed. A preset whitelist matching and priority sorting are used to ensure that the correct key values are output.
It accurately detects and handles ghost key issues, increases the likelihood of correctly eliminating ghost keys, and requires no hardware modifications, offering good compatibility.
Smart Images

Figure CN121879592B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of keyboard technology, and in particular to a method, apparatus and keyboard for handling ghost keys. Background Technology
[0002] This section is intended to provide background or context for the embodiments disclosed herein. The description herein is not intended to imply that it is prior art simply because it is included in this section.
[0003] Preventing ghost keys has always been a technical challenge in the development of keyboard technology. A ghost key occurs when a user presses multiple keys simultaneously, and the system mistakenly detects that a key that wasn't actually pressed has been activated. The main reason for this is the use of matrix keys in keyboard design, which creates a circuit design flaw. This flaw allows three or more keys to be pressed simultaneously, forming an equivalent conducting loop. This loop can then be mistakenly interpreted as a pressed key, leading the system to incorrectly register that key as pressed.
[0004] Although high-end and mid-range keyboards can now achieve full N-key rollover by using mechanical keyboards or adding circuits such as diodes to prevent ghosting, due to cost and other reasons, ordinary membrane keyboards and low-priced mechanical keyboards are still the mainstream in the current keyboard market, and these low-end keyboards are still plagued by ghosting issues. Summary of the Invention
[0005] Therefore, it is necessary to provide a keyboard ghost key processing method, device, and keyboard that can handle the keyboard ghost key problem at low cost, in order to address the above-mentioned technical problems.
[0006] Firstly, this disclosure provides a method for handling keyboard ghost keys. The method includes:
[0007] Get the key values detected in the current window and the key values output in the previous window from the keyboard;
[0008] Determine whether the difference between the number of key presses detected in the current window and the number of key presses output in the previous window is greater than 1, and obtain the first determination result;
[0009] When the difference between the number of key presses detected in the current window and the number of key presses output in the previous window is greater than 1, the current window scan data is obtained.
[0010] Determine whether a first detection key value exists in the current window scan data to obtain a second determination result; the number of keys for the first detection key value is less than the number of keys for the current window detection key value, and the first detection key value includes the output key value of the previous window;
[0011] When the second judgment result includes the presence of a first detection key value in the current window scan data, the first detection key value is used as the output key value of the current window.
[0012] Optionally, the method further includes:
[0013] When the second judgment result includes the absence of the first detection key value in the current window scan data, the current window detection key value is matched with a preset whitelist to obtain a matching result;
[0014] When the matching result includes a match between the current window detection key value and the first preset key value, the first preset key value is used as the output key value of the current window; the number of keys in the first preset key value is less than the number of keys in the current window detection key value, the current window detection key value includes the first preset key value, and the first preset key value includes the output key value of the previous window.
[0015] Optionally, the preset key values in the preset whitelist are sorted by priority from high to low frequency of use; the method further includes:
[0016] When there is more than one first preset key value, the first preset key value with the highest priority in the preset whitelist will be used as the output key value of the current window.
[0017] Optionally, the method further includes:
[0018] When the matching result includes a failed match, the output key value of the previous window is used as the output key value of the current window.
[0019] Optionally, the method further includes:
[0020] When the difference between the number of key presses detected in the current window and the number of key presses output in the previous window does not exceed 1, the key press detected in the current window is used as the output key press of the current window.
[0021] Optionally, the current window scan data includes at least three detection key values, and the detection time for each window is less than 10 milliseconds.
[0022] Optionally, the method further includes: after the first judgment result includes the difference between the number of key presses for detecting key values in the current window and the number of key presses for outputting key values in the previous window being greater than 1, and the output key value of the current window is determined, reminding the user to pay attention to whether the output key value is accurate.
[0023] Optionally, the method further includes:
[0024] When there is more than one first detection key value, the first detection key value that appears most frequently in the current window scan data is taken as the output key value of the current window.
[0025] Secondly, this disclosure also provides a keyboard ghost key processing device. The device includes:
[0026] The first data acquisition module acquires the key values detected in the current window and the key values output in the previous window from the keyboard.
[0027] The first judgment module is used to determine whether the difference between the number of key presses detected in the current window and the number of key presses output in the previous window is greater than 1, and to obtain the first judgment result.
[0028] The second data acquisition module is used to acquire the current window scan data when the difference between the number of key values detected in the current window and the number of key values output in the previous window is greater than 1 in the first judgment result.
[0029] The second judgment module is used to determine whether a first detection key value exists in the current window scan data, and to obtain a second judgment result; the number of keys for the first detection key value is less than the number of keys for the current window detection key value, and the first detection key value includes the output key value of the previous window;
[0030] The key value output module is used to use the first detection key value as the output key value of the current window when the second judgment result includes the presence of a first detection key value in the current window scan data.
[0031] Thirdly, this disclosure also provides a keyboard. The keyboard includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0032] Get the key values detected in the current window and the key values output in the previous window from the keyboard;
[0033] Determine whether the difference between the number of key presses detected in the current window and the number of key presses output in the previous window is greater than 1, and obtain the first determination result;
[0034] When the difference between the number of key presses detected in the current window and the number of key presses output in the previous window is greater than 1, the current window scan data is obtained.
[0035] Determine whether a first detection key value exists in the current window scan data to obtain a second determination result; the number of keys for the first detection key value is less than the number of keys for the current window detection key value, and the first detection key value includes the output key value of the previous window;
[0036] When the second judgment result includes the presence of a first detection key value in the current window scan data, the first detection key value is used as the output key value of the current window.
[0037] The aforementioned keyboard ghost key processing method, device, and keyboard first analyze the number of key values in two consecutive detection windows to identify abnormal key values containing ghost keys. Then, it searches for key values that might match the user's actual keystrokes from multiple detections in the current window. This provides a novel method for handling ghost keys, achieving the technical effect of accurately detecting and resolving ghost key problems. Compared to existing technologies that directly discard key values or directly output key values containing ghost keys when encountering them, the method in this application can process only abnormal key values. Furthermore, through innovations such as conditional constraints on the first detected key value, it can improve the probability of correctly eliminating ghost keys. Attached Figure Description
[0038] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.
[0039] Figure 1 This is a flowchart illustrating a keyboard ghost key handling method in one embodiment;
[0040] Figure 2 This is a structural block diagram of a keyboard ghost key processing device in one embodiment. Detailed Implementation
[0041] To make the objectives, technical solutions, and advantages of this disclosure clearer, the following detailed description, in conjunction with the accompanying drawings and embodiments, provides a more comprehensive understanding of this disclosure. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this disclosure. In the following detailed description of this application, certain specific details are described in detail. Those skilled in the art can fully understand this application even without these detailed descriptions. To avoid obscuring the essence of this application, well-known methods, processes, flows, elements, and circuits are not described in detail.
[0042] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.
[0043] The keyboard ghost key processing method provided in this disclosure can be applied to various application environments, such as keyboards using matrix keys. The keyboard may include a data transceiver port, a data storage system, and a processor. The data transceiver port can communicate with the processor, and the data storage system can store data that the processor needs to process. The processor can acquire the current window detected key value and the previous window output key value; then, it determines whether the difference between the number of keys in the current window detected key value and the number of keys in the previous window output key value is greater than 1, obtaining a first determination result. When the first determination result includes a difference between the number of keys in the current window detected key value and the number of keys in the previous window output key value that is greater than 1, the processor can acquire current window scan data and then determine whether a first detected key value exists in the current window scan data, obtaining a second determination result. The number of keys in the first detected key value is less than the number of keys in the current window detected key value, and the first detected key value includes the previous window output key value. When the second determination result includes the presence of a first detected key value in the current window scan data, the processor uses the first detected key value as the current window output key value.
[0044] In one embodiment, such as Figure 1 As shown, a method for handling ghost keys on a keyboard is provided. Taking the application of this method in the above-mentioned scenario as an example, the method includes the following steps:
[0045] Step 102: Obtain the key values detected in the current window and the key values output in the previous window.
[0046] Here, "window" can refer to the detection time length corresponding to the keyboard output key value. "Current window detection key value" can refer to the content of the key pressed on the keyboard detected by the latest detection window. "Previous window output key value" can refer to the keyboard output key value corresponding to the previous detection window sorted by detection time.
[0047] Specifically, a window can be considered the sum of the detection times of a set of key values on the keyboard. Each window can perform one or more detections (or scans), and each window outputs a detection result once. In existing technology, for a given keyboard, the number of detections performed within a window is generally fixed. When multiple detections are performed within a window, the detection result with the most frequent occurrences is taken as the corresponding window detection key value, and output is performed according to that window detection key value to eliminate the influence of key bounce on the window detection key value. For example, if window A includes 5 detections, and the 5 detection key values are XY, X, XY, XY, and XY, then XY is determined as the detection key value of window A, and XY will be output as the output key value of window A. For example, the processor has already determined and output XY based on the detection key values included in window A. Next, the processor obtains the detection key value of window B to determine the output key value of window B. Then, window B is the current window, and the detection key value of window B is the detection key value of the current window. Window A is the previous window of window B, and XY is the output key value of the previous window.
[0048] Step 104: Determine whether the difference between the number of key presses for detecting key values in the current window and the number of key presses for outputting key values in the previous window is greater than 1, and obtain the first determination result.
[0049] Specifically, the key count of a key value can refer to the number of keys contained within that key value. For example, a key value of WASD contains the keys W, A, S, and D, so its key count is 4, indicating that all four keys were pressed simultaneously. Similarly, a key value of 567 contains the keys 5, 6, and 7, so its key count is 3, indicating that all three keys were pressed simultaneously. If the key count detected by the current window is 'a', and the key count output by the previous window is 'b', then the condition (ab) > 1 is checked. This result is called the first condition.
[0050] Step 106: When the difference between the number of key presses for the current window's detected key value and the number of key presses for the previous window's output key value is greater than 1, obtain the current window's scan data.
[0051] The current window scan data can refer to data containing the key value detection results of the current window at each time.
[0052] Specifically, the content of the key value detected in the current window is determined by the processor based on the current window scan data. For example, based on the statistical results of the key values detected in each scan of the current window scan data, the key value that appears most frequently is determined as the key value detected in the current window. When the first judgment result (ab) > 1 is true, the processor obtains the current window scan data, which is the source data used to determine the key value detected in the current window. Since the number of keys detected in the current window and the number of keys output in the previous window are both integers, when (ab) > 1, the minimum value of (ab) is 2. In practical applications of the keyboard, users may press multiple keys simultaneously, which is the scenario where ghost keys are generated. However, due to the limitations of human physiological mechanisms, there is still a tiny time difference between the multiple keys that the user perceives as being pressed simultaneously. This time difference is generally between 10 and 50 milliseconds. Due to the high-speed scanning and detection of key values by the keyboard, the total detection time of each window will be less than the aforementioned tiny time difference, generally a few milliseconds or even less. This means that for the key value scanning of the keyboard, multiple keys pressed by the user simultaneously will be detected sequentially. In other words, under normal circumstances, the number of keys detected in each window can increase by at most one compared to the number of keys output by the previous window. Therefore, when (ab) > 1, it can be determined that the key value detected in the current window does not match the actual key presses made by the user on the keyboard. That is, it can be determined that the key value detected in the current window is an abnormal key value containing ghost keys. If it is used as the output key value of the current window, it will definitely produce an incorrect output. In existing technology, key values containing ghost keys are generally identified by comparing the keyboard output key values with the user's actual key presses. However, in this step, abnormal key values that may contain ghost keys can be identified simply through data processing.
[0053] Step 108: Determine whether a first detection key value exists in the current window scan data to obtain a second determination result; the number of keys for the first detection key value is less than the number of keys for the current window detection key value, and the first detection key value includes the output key value of the previous window.
[0054] Specifically, the first detection key value must simultaneously meet three conditions: 1. The first detection key value is a detection key value in the current window's scan data, that is, a key value obtained from at least one detection performed within the current window; 2. The number of keys for the first detection key value is less than the number of keys for the current window's detection key value; 3. The first detection key value includes the output key value of the previous window. For example, if the current window's scan data contains 5 detection results, namely ABDE, ABDE, ABDE, ABD, and ABDE, then ABDE, which appears most frequently, is determined to be the current window's detection key value. Since the previous window's output key value is AB, ABD among the aforementioned 5 detection results simultaneously meets the above three conditions. Therefore, it can be determined that ABD is the first detection key value present in the current window's scan data.
[0055] Step 110: When the second judgment result includes the presence of a first detection key value in the current window scan data, the first detection key value is used as the output key value of the current window.
[0056] Specifically, when the second judgment result includes the presence of a first detected key value in the current window scan data, unlike the prior art which uses the current window detected key value as the output key value, this step uses the first detected key value as the output key value of the current window. Since ghost keys are generated from the equivalent conduction circuit formed after multiple keys are pressed, this circuit has a longer current path than the normal key value detection circuit and involves significantly more keys. Therefore, the key pressure and contact stability of all related keys can affect the stability of this circuit, which in turn affects the stability of the ghost key signal. When factors prevent the ghost key signal from being reproduced, a first detected key value may be detected that simultaneously contains the output key value of the previous window and has fewer keys than the current window detected key value. The first detected key value is more likely to correspond to the user's actual pressing state than the current window detected key value.
[0057] In this embodiment, the number of key values detected in two consecutive detection windows is first used to analyze abnormal key values containing ghost keys. Then, key values that may match the user's actual keystrokes are searched from multiple detected key values in the current window. This provides a new method for handling ghost keys, achieving the technical effect of accurately detecting and resolving ghost key problems. Compared to existing technologies that directly discard key values or directly output key values containing ghost keys when encountering them, the method in this embodiment can process only abnormal key values. Furthermore, through innovative measures such as conditional constraints on the first detected key value, the probability of correctly eliminating ghost keys is significantly improved. Moreover, the method in this embodiment is a purely software-level innovation, without involving hardware modifications, and can be well-compatible with existing keyboard designs in practical applications.
[0058] In one embodiment, the method further includes:
[0059] When the second judgment result includes the absence of the first detection key value in the current window scan data, the current window detection key value is matched with a preset whitelist to obtain a matching result;
[0060] When the matching result includes a match between the current window detection key value and the first preset key value, the first preset key value is used as the output key value of the current window; the number of keys in the first preset key value is less than the number of keys in the current window detection key value, the current window detection key value includes the first preset key value, and the first preset key value includes the output key value of the previous window.
[0061] The preset whitelist can refer to a set of preset key values. These preset key values are generally commonly used keyboard key combinations. The first preset key value can be a key value in the preset whitelist that successfully matches the key value detected by the current window.
[0062] Specifically, a preset whitelist can be created in advance, which includes commonly used key combinations. When the first detection key value cannot be found in the scan data of the current window, the detection key value of the current window can be matched with the preset whitelist to search for the first preset key value. The first preset key value also needs to meet three conditions: 1. The first preset key value belongs to the preset whitelist; 2. The number of keys in the first preset key value is less than the number of keys in the detection key value of the current window; 3. The first preset key value contains the output key value of the previous window. For example, if all detection key values in the scan data of the current window are ABDE, the detection key value of the current window is ABDE, the output key value of the previous window is AB, and the key value that meets all three conditions is ABE, then ABE is used as the output key value of the current window.
[0063] In this embodiment, by designing a preset whitelist and matching rules, the first preset key value matched may match the user's actual key press situation. Compared with outputting or discarding abnormal key values, this can improve the possibility of correctly removing ghost keys.
[0064] In one embodiment, the preset key values in the preset whitelist are sorted by priority from high to low frequency of use; the method further includes:
[0065] When there is more than one first preset key value, the first preset key value with the highest priority in the preset whitelist will be used as the output key value of the current window.
[0066] Specifically, the priority of preset keys can be set in the preset whitelist, with each preset key having a different priority order. For example, preset keys in the whitelist can be sorted according to their frequency of use, with higher-ranked preset keys having higher matching priority. When multiple first preset keys matching the conditions are found from the preset whitelist, the first preset key with the highest frequency priority can be used as the output key of the current window. For example, if all detection keys in the current window's scan data are ABDE, the current window's detection key is ABDE, and the previous window's output key is BE, then the first preset keys that match the conditions are ABE and BDE. However, in the preset whitelist, ABE has a higher priority, so ABE is used as the output key of the current window.
[0067] In this embodiment, by setting the matching priority of preset key values in the preset whitelist, the first preset key value with higher frequency of use is matched first. Since higher frequency of use means that the user's actual key press is more likely to be the corresponding preset key value, the possibility of correctly removing ghost keys can be improved.
[0068] In one embodiment, the method further includes:
[0069] When the matching result includes a failed match, the output key value of the previous window is used as the output key value of the current window.
[0070] Specifically, if the first detection key value cannot be found in the scan data of the current window, nor can it be matched with the first preset key value from the preset whitelist, then the output key value of the previous window is directly used as the output key value of the current window. This is equivalent to discarding the detection key value of the current window, giving the user the effect that the output key value remains unchanged, thus allowing the user to promptly detect key output faults. For example, if all detection key values in the scan data of the current window are ABDE, the detection key value of the current window is ABDE, and the output key value of the previous window is BE, and the first preset key value cannot be matched, then BE is used as the output key value of the current window.
[0071] In one embodiment, the method further includes:
[0072] When the difference between the number of key presses detected in the current window and the number of key presses output in the previous window does not exceed 1, the key press detected in the current window is used as the output key press of the current window.
[0073] Specifically, when the difference between the number of key presses 'a' in the current window and the number of key presses 'b' in the previous window's output key value does not exceed 1 (i.e., (ab) ≤ 1), according to the aforementioned judgment logic, it indicates that the key values detected in the current window do not contain ghost keys. Therefore, the key values detected in the current window can be directly used as the output key values of the current window. In this embodiment, the number of key values detected in two consecutive windows is used to identify the key values detected in the current window that do not contain ghost keys, thereby avoiding the current window's key values being mistakenly identified as potentially containing ghost keys and processed incorrectly. For example, if all the key values detected in the current window's scan data are QAWS, the current window's key value is QAWS, and the previous window's output key value is QAW, it can be determined that QAWS does not contain ghost keys and can be directly output. If, according to existing technology, QAWS is detected as conforming to a rectangular circuit that may generate ghost keys, then QAWS may be discarded. However, the solution in this embodiment can avoid this situation.
[0074] In one embodiment, the current window scan data includes at least three detection key values, and the detection duration for each window is less than 10 milliseconds.
[0075] Specifically, at least three checks are performed within each window, ensuring that the current window's scan data includes at least three detected key values, and the total check duration for the entire window is less than 10 milliseconds. For example, the number of detected key values in the current window's scan data can be 3, 4, 5, 6, 7, 8, 9, or more, and the total check duration for each window can be 9 milliseconds, 8 milliseconds, 7 milliseconds, 6 milliseconds, or 5 milliseconds, etc. For instance, a check window might include 8 checks, each lasting 1 millisecond, for a total check duration of 8 milliseconds. More checks help eliminate the impact of mechanical jitter on the detected key values in the current window and increase the likelihood of detecting the first detected key value that meets the criteria when a ghost key appears. Shorter check durations for each window help avoid overlap between the window's check duration and the small time difference between a person pressing a key simultaneously, thus increasing the probability of accurately identifying abnormal key values and helping to correctly handle ghost key issues.
[0076] In one embodiment, the method further includes: after the first determination result includes a difference of more than 1 between the number of keystrokes used to detect key values in the current window and the number of keystrokes used to output key values in the previous window, and the output key value of the current window is determined, reminding the user to check whether the output key value is accurate. For example, a corresponding reminder can be displayed as a small pop-up window on the computer screen. The reminder content can be "Ghost keys have been intelligently processed, please check whether the output is accurate" or "Please check whether the output is correct". The program can be set to automatically disappear after 1-2 seconds to avoid requiring the user to manually close it.
[0077] In one embodiment, the method further includes: when there is more than one first detection key value, counting the frequency of each first detection key value in the current window scan data, that is, how many detections in the current detection window each first detection key value belongs to as a common result. Then, the first detection key value with the highest frequency in the current window scan data is used as the output key value of the current window.
[0078] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0079] Based on the same inventive concept, this disclosure also provides a keyboard ghost key processing device for implementing the keyboard ghost key processing method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations in one or more embodiments of the keyboard ghost key processing device provided below can be found in the limitations of the keyboard ghost key processing method described above, and will not be repeated here.
[0080] In one embodiment, such as Figure 2 As shown, a keyboard ghost key processing device is provided, comprising: a first data acquisition module 10, a first judgment module 20, a second data acquisition module 30, a second judgment module, and a key value output module 40, wherein:
[0081] The first data acquisition module 10 acquires the key values detected in the current window and the key values output in the previous window from the keyboard.
[0082] The first judgment module 20 is used to determine whether the difference between the number of key presses for the current window's detected key value and the number of key presses for the previous window's output key value is greater than 1, and to obtain the first judgment result.
[0083] The second data acquisition module 30 is used to acquire the current window scan data when the difference between the number of key presses detected in the current window and the number of key presses output in the previous window is greater than 1 in the first judgment result.
[0084] The second judgment module 40 is used to determine whether a first detection key value exists in the current window scan data and obtain a second judgment result; the number of keys for the first detection key value is less than the number of keys for the current window detection key value, and the first detection key value includes the output key value of the previous window.
[0085] The key value output module 50 is used to use the first detection key value as the output key value of the current window when the second judgment result includes the presence of a first detection key value in the current window scan data.
[0086] In one embodiment, the apparatus further includes:
[0087] The key-value matching module is used to match the current window detection key value with a preset whitelist to obtain a matching result when the second judgment result includes the absence of a first detection key value in the current window scan data.
[0088] The key-value output module is further configured to, when the matching result includes a match between the current window's detected key value and a first preset key value, use the first preset key value as the output key value of the current window. The number of keys for the first preset key value is less than the number of keys for the current window's detected key value. The current window's detected key value includes the first preset key value, and the first preset key value includes the output key value of the previous window.
[0089] In one embodiment, the device further includes a key-value output module, which is further configured to, when there is more than one first preset key-value, use the first preset key-value with the highest priority in the preset whitelist as the output key-value of the current window. The preset key-values in the preset whitelist are sorted by priority from high to low frequency of use.
[0090] In one embodiment, the apparatus further includes:
[0091] The key-value output module is also used to use the key-value output of the previous window as the key-value output of the current window when the matching result includes a matching failure.
[0092] In one embodiment, the apparatus further includes:
[0093] The key value output module is further configured to use the key value detected in the current window as the output key value of the current window when the difference between the number of key values detected in the current window and the number of key values output in the previous window does not exceed 1.
[0094] In one embodiment, the device further includes: the current window scan data acquired by the second data acquisition module includes at least three detection key values, and the detection duration of each window is less than 10 milliseconds.
[0095] In one embodiment, the device further includes a ghost key reminder module, used to remind the user to pay attention to whether the output key value is accurate after the first judgment result includes the difference between the number of key presses for the current window's detected key value and the number of key presses for the previous window's output key value is greater than 1, and the output key value of the current window is determined.
[0096] In one embodiment, the apparatus further includes:
[0097] The key value output module is also used to take the first detection key value that appears most frequently in the current window scan data as the output key value of the current window when there is more than one first detection key value.
[0098] Each module in the aforementioned keyboard ghost key processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the keyboard's processor in hardware form, or stored in the keyboard's memory in software form, so that the processor can call and execute the operations corresponding to each module. In one embodiment, a keyboard is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the steps in any of the above method embodiments.
[0099] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0100] The embodiments described above are merely illustrative of several implementations of this disclosure, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent disclosure. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this disclosure, and these all fall within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the appended claims.
Claims
1. A method for handling ghost keys on a keyboard, characterized in that, The method includes: Get the key values detected in the current window and the key values output in the previous window from the keyboard; Determine whether the difference between the number of key presses detected in the current window and the number of key presses output in the previous window is greater than 1, and obtain the first determination result; When the difference between the number of key presses detected in the current window and the number of key presses output in the previous window is greater than 1, the current window scan data is obtained; the current window scan data is data containing the key value detection results of the current window in each iteration. Determine whether a first detection key value exists in the current window scan data to obtain a second determination result; the number of keys for the first detection key value is less than the number of keys for the current window detection key value, and the first detection key value includes the output key value of the previous window; When the second judgment result includes the presence of a first detection key value in the current window scan data, the first detection key value is used as the output key value of the current window.
2. The method according to claim 1, characterized in that, The method further includes: When the second judgment result includes the absence of the first detection key value in the current window scan data, the current window detection key value is matched with a preset whitelist to obtain a matching result; When the matching result includes a match between the current window detection key value and the first preset key value, the first preset key value is used as the output key value of the current window; the number of keys in the first preset key value is less than the number of keys in the current window detection key value, the current window detection key value includes the first preset key value, and the first preset key value includes the output key value of the previous window.
3. The method according to claim 2, characterized in that, The preset key values in the preset whitelist are sorted by priority from high to low frequency of use; the method further includes: When there is more than one first preset key value, the first preset key value with the highest priority in the preset whitelist will be used as the output key value of the current window.
4. The method according to claim 2, characterized in that, The method further includes: When the matching result includes a failed match, the output key value of the previous window is used as the output key value of the current window.
5. The method according to claim 1, characterized in that, The method further includes: When the difference between the number of key presses detected in the current window and the number of key presses output in the previous window does not exceed 1, the key press detected in the current window is used as the output key press of the current window.
6. The method according to claim 1, characterized in that, The current window scan data includes at least three detection key values, and the detection time for each window is less than 10 milliseconds.
7. The method according to claim 1, characterized in that, The method further includes: If the difference between the number of key presses for the current window's key value and the number of key presses for the previous window's key value is greater than 1, and the current window's key value is determined, the user is reminded to check whether the key value is accurate.
8. The method according to claim 1, characterized in that, The method further includes: When there is more than one first detection key value, the first detection key value that appears most frequently in the current window scan data is taken as the output key value of the current window.
9. A keyboard ghost key processing device, characterized in that, The device includes: The first data acquisition module acquires the key values detected in the current window and the key values output in the previous window from the keyboard. The first judgment module is used to determine whether the difference between the number of key presses detected in the current window and the number of key presses output in the previous window is greater than 1, and to obtain the first judgment result. The second data acquisition module is used to acquire the current window scan data when the difference between the number of key values detected in the current window and the number of key values output in the previous window is greater than 1 in the first judgment result. The second judgment module is used to determine whether a first detection key value exists in the current window scan data, and to obtain a second judgment result; the number of keys for the first detection key value is less than the number of keys for the current window detection key value, and the first detection key value includes the output key value of the previous window; The key value output module is used to use the first detection key value as the output key value of the current window when the second judgment result includes the presence of a first detection key value in the current window scan data.
10. A keyboard, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 8.