CN106293132B - A kind of method and keyboard filter driving improving keyboard input correctness - Google Patents

A kind of method and keyboard filter driving improving keyboard input correctness Download PDF

Info

Publication number
CN106293132B
CN106293132B CN201610681143.2A CN201610681143A CN106293132B CN 106293132 B CN106293132 B CN 106293132B CN 201610681143 A CN201610681143 A CN 201610681143A CN 106293132 B CN106293132 B CN 106293132B
Authority
CN
China
Prior art keywords
module
keyboard input
keyboard
key
filter driver
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610681143.2A
Other languages
Chinese (zh)
Other versions
CN106293132A (en
Inventor
陆舟
于华章
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Feitian Technologies Co Ltd
Original Assignee
Feitian Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN201610681143.2A priority Critical patent/CN106293132B/en
Publication of CN106293132A publication Critical patent/CN106293132A/en
Application granted granted Critical
Publication of CN106293132B publication Critical patent/CN106293132B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/02Input arrangements using manually operated switches, e.g. using keyboards or dials
    • G06F3/023Arrangements for converting discrete items of information into a coded form, e.g. arrangements for interpreting keyboard generated codes as alphanumeric codes, operand codes or instruction codes

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Input From Keyboards Or The Like (AREA)

Abstract

The present invention discloses the method and keyboard filter driving of a kind of raising keyboard input correctness, belongs to electronic equipment input field.This method comprises: keyboard filter driving obtains keyboard input data from system, current keyboard input information is obtained in data entered from the keyboard, current keyboard input data is handled according to current keyboard input information and the correction itself saved mark, after keyboard input data has handled keyboard input information all in keyboard input data, by keyboard input data return system.Keyboard filter driving disclosed by the invention includes: the first acquisition module, the second acquisition module, preserving module, rectification module, the first update module, memory module, the first remove module, the second update module, the second remove module, setup module and return module.Method provided by the invention and keyboard filter driving improve the correctness of keyboard input data.

Description

Method for improving keyboard input correctness and keyboard filter driver
Technical Field
The invention relates to the field of electronic equipment input, in particular to a method for improving keyboard input correctness and a keyboard filter driver.
Background
The driving architecture of Windows is processed hierarchically, wherein the drivers for the PS2 keyboard device include a keyboard filter driver, and a system keyboard driver of the Windows system (the system keyboard driver includes a system keyboard bottom driver and a system keyboard class driver). The PS2 keyboard sends the PS2 keyboard input data to the 8042 controller, the system keyboard driver takes out the keyboard input data from the controller and processes the keyboard input data to obtain the keyboard input information of the preset structure, and the keyboard input information of the preset structure is transmitted to the keyboard filter driver. PS2 keyboard input data may have one byte or two bytes, while a controller receiving PS2 keyboard input data can only receive one byte of data at a time; keypad filter driver to prevent theft of keypad input data entered by a PS2 keypad in the 8042 controller, it is possible to access the 8042 controller simultaneously with a PS2 keypad, sending analog keypad input data to the controller.
In the prior art, the keyboard input method has the following disadvantages: if the PS2 keyboard sends PS2 keyboard input data to the 8042 controller, and before the system keyboard driver takes the PS2 keyboard input data from the controller away, the keyboard filter driver sends simulated keyboard input data to the 8042 controller, the simulated keyboard input data will overwrite the PS2 keyboard input data, resulting in a failure of the PS2 keyboard input data; when the PS2 keyboard sends PS2 keyboard input data to the controller, the PS2 keyboard sends the first byte to the controller, and if the keyboard filter driver sends the simulated keyboard input data to the 8042 controller, the first byte and the second byte of the PS2 keyboard input data of the two bytes are split by the simulated keyboard input data, and the keyboard filter driver separately transmits the acquired keyboard input information corresponding to the first byte and the acquired keyboard input information corresponding to the second byte to the upper layer application, which finally results in that the PS2 keyboard input data received by the upper layer application is incorrect. Accordingly, a keyboard input method capable of improving the correctness of the PS2 keyboard input data is needed.
Disclosure of Invention
The present invention provides a method for improving input correctness and a keyboard filter driver for solving the technical problems in the prior art.
The invention provides a method for improving input correctness, which comprises the following steps:
step S1: the keyboard filter driver acquires keyboard input data from the system;
step S2: the keyboard filter driver acquires current keyboard input information from the keyboard input data;
when the current keyboard input information is not interference information and the correction identifier stored by the keyboard filter driver is not a default identifier, executing step S3;
when the current keyboard input information is interference information and the correction identifier stored by the keyboard filter driver is not a default identifier, executing step S4;
when the current keyboard input information is interference information and the correction identifier stored by the keyboard filter driver is a default identifier, executing step S5;
when the keyboard filter driver is initialized, the keyboard filter driver sets the correction identifier as a default identifier;
step S3: the keyboard filter driver corrects a first key identification in current keyboard input information, updates the correction identification into a default identification, and stores the corrected current keyboard input information into a corresponding position in keyboard input data;
step S4: the keyboard filter driver removes the current keyboard input information from the keyboard input data;
step S5: the keyboard filter driver updates the correction identifier stored by the keyboard filter driver according to the first key identifier in the current keyboard input information, and removes the current keyboard input information from the keyboard input data;
and after the keyboard filter driver processes all the keyboard input information in the keyboard input data, returning the keyboard input data to the system.
The invention provides a keyboard filter driver, comprising:
the first acquisition module is used for acquiring keyboard input data from the system;
the second acquisition module is used for acquiring current keyboard input information from the keyboard input data;
the storage module is used for storing the correction identifier;
the correction module is used for correcting the first key identification in the current keyboard input information when the current keyboard input information acquired by the second acquisition module is not interference information and the correction identification stored by the storage module is not a default identification;
the first updating module is used for updating the correction identifier stored by the storage module into a default identifier after the correction module corrects the first key identifier in the current keyboard input information;
the storage module is used for storing the current keyboard input information corrected by the correction module to a corresponding position in the keyboard input data;
the first removing module is used for removing the current keyboard input information from the keyboard input data when the current keyboard input information acquired by the second acquiring module is interference information and the correction identifier stored by the storing module is not a default identifier;
the second updating module is used for updating the correction identifier stored by the storage module according to the first key identifier in the current keyboard input information when the current keyboard input information acquired by the second acquiring module is interference information and the correction identifier stored by the storage module is a default identifier;
the second removing module is used for removing the current keyboard input information from the keyboard input data after the second updating module updates the correction identifier stored by the storage module according to the first key identifier in the current keyboard input information;
the setting module is used for setting the correction identifier stored by the storage module as a default identifier when the keyboard filter driver is initialized;
and the returning module is used for returning the keyboard input data to the system after the keyboard filter driver finishes processing all the keyboard input information in the keyboard input data acquired by the first acquiring module.
Compared with the prior art, the invention has the beneficial effects that: the keyboard filter driver acquires the keyboard input data from the system, and after acquiring the current keyboard input information from the keyboard input data, the keyboard filter driver processes the current keyboard input information according to the acquired current keyboard input information and the correction identifier stored by the keyboard filter driver, so that the keyboard input accuracy is improved.
Drawings
Fig. 1 is a flowchart of a method for improving keyboard input correctness in embodiment 1 of the present invention;
fig. 2 is a flowchart of a method for improving keyboard input correctness according to embodiment 2 of the present invention;
fig. 3 is a flowchart of a method for improving keyboard input correctness according to embodiment 3 of the present invention;
fig. 4 is a block diagram illustrating module components of a keyboard filter driver according to embodiment 4 of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Example 1
The present embodiment provides a method for improving keyboard input correctness, as shown in fig. 1, including:
step S1: the keyboard filter driver acquires keyboard input data from the system;
step S2: the keyboard filter driver acquires current keyboard input information from the keyboard input data;
when the correction identifier stored by the keyboard filter driver is not the default identifier and the current keyboard input information is not the interference information, executing step S3;
when the correction identifier stored by the keyboard filter driver is not the default identifier and the current keyboard input information is interference information, executing step S4;
when the correction identifier stored by the keyboard filter driver is the default identifier and the current keyboard input information is the interference information, executing step S5;
setting the correction identifier as a default identifier by the keyboard filter driver when the keyboard filter driver is initialized;
step S3: the keyboard filter driver corrects a first key identification in current keyboard input information, updates the correction identification into a default identification, and stores the corrected current keyboard input information into a corresponding position in keyboard input data;
step S4: the keyboard filter driver removes the current keyboard input information from the keyboard input data;
step S5: the keyboard filter driver updates the correction identifier stored by the keyboard filter driver according to the first key identifier in the current keyboard input information, and removes the current keyboard input information from the keyboard input data;
and after the keyboard filter driver processes all the keyboard input information in the keyboard input data, returning the keyboard input data to the system.
In this embodiment, the method further includes:
step N1: the keyboard filter driver sends a keyboard input prohibition instruction to the controller;
step N2: the keyboard filter driver sends analog keyboard input data to the controller, the analog keyboard input data are transmitted to the system through the controller, the analog keyboard input data are processed through the system to obtain keyboard input information, and the keyboard input information is stored in the keyboard input data;
in step N2, after the keyboard filter driver sends the simulated keyboard input data to the controller, the method further includes: the keypad filter driver sends a keypad enable command to the controller.
Optionally, before the step N1, the method further includes: the keypad filter driver waits for the controller to idle.
Optionally, after the keyboard filter driver sends the simulated keyboard input data to the controller in step N2, the method further includes: generating and storing information records by a keyboard filter driver;
and when the current keyboard input information acquired by the keyboard filter driver is interference information, the information record corresponding to the current keyboard input information is provided.
Optionally, in this embodiment, in the step S1, the method further includes: the keyboard filter driver calculates the number of keyboard input information in the keyboard input data;
accordingly, before step S2, the method further includes:
step m1, the keyboard filter driver judges whether the circulation times is less than the number of the keyboard input information, if yes, step S2 is executed, otherwise, the keyboard input data is returned to the system;
after the keyboard filter driver processes the current keyboard input information obtained from the keyboard input data each time, the method further comprises the following steps:
step m 2: the keyboard filter driver adds one to the cycle number and returns to the step m 1;
when the keyboard filter driver is initialized, the keyboard filter driver sets the cycle number as an initial value.
Specifically, the initial value of the number of cycles is 0.
The keyboard filter driver further comprises a step m2 after processing the current keyboard input information obtained from the keyboard input data each time, namely after the step S3-the step S5.
Optionally, in the method of this embodiment, the correction identifier is a second key identifier stored in the keyboard filter driver; correspondingly, the default identification is a default key identification;
the keyboard filters the first key sign in the drive correction current keyboard input information, will correct the sign and update as acquiescent sign, specifically does: and the keyboard filter driver corrects the first key identification in the current keyboard input information according to the second key identification stored by the keyboard filter driver, and updates the second key identification into the default key identification.
Specifically, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored in the keyboard filter driver, specifically: the keyboard filter driver adds the value of the second key identifier and the value of the first key identifier, and updates the first key identifier by using the operation result;
correspondingly, in the above method, the updating of the correction identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information by the keyboard filter driver specifically includes: and the keyboard filter driver subtracts the corresponding key state value from the value of the first key identifier in the current keyboard input information, and updates the second key identifier by using the operation result.
Specifically, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored in the keyboard filter driver, specifically: the keyboard filter driver performs bit OR operation on the value of the second key identifier and the value of the first key identifier, and updates the first key identifier by using an operation result;
correspondingly, in the above method, the updating of the correction identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information by the keyboard filter driver specifically includes: and the keyboard filter driver inverts the key state value corresponding to the current keyboard input information, performs bit AND operation on the inverted result and the value of the first key identifier in the current keyboard input information, and updates the second key identifier by using the operation result.
Specifically, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored in the keyboard filter driver, specifically: when the value of the first key identification is a first preset value or a second preset value stored by the keyboard filter driver, the keyboard filter driver updates the first key identification in the current keyboard input information by using the second key identification stored by the keyboard filter driver;
correspondingly, in the above method, the updating of the correction identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information by the keyboard filter driver specifically includes: and when the first key identification is not the first preset value or the second preset value stored by the keyboard filter driver, or when the value of the first key identification is not equal to the value of the third key identification in the corresponding information record, or when the value of the first key identification is not equal to the key state value corresponding to the current keyboard input information, the keyboard filter driver updates the second key identification stored by the keyboard filter driver by using the first key identification.
For example, the first preset value is 0, and the second preset value is 1.
Or, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored by the keyboard filter driver, specifically: when the value of the first key identification is equal to the key state value corresponding to the current keyboard input information, the keyboard filter driver updates the first key identification in the current keyboard input information by using a second key identification stored by the keyboard filter driver;
correspondingly, in the above method, the updating of the correction identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information by the keyboard filter driver specifically includes: and when the value of the first key identification is not equal to the key state value corresponding to the current keyboard input information, or when the value of the first key identification is not equal to the value of the third key identification in the corresponding information record, or when the value of the first key identification is not the first preset value or the second preset value stored by the keyboard filter driver, the keyboard filter driver updates the second key identification stored by the keyboard filter driver by using the first key identification.
Optionally, in the method of this embodiment, the keyboard filter driver corrects a first key identifier in current keyboard input information, and updates the correction identifier to a default identifier, specifically: when the value of the first key identification is a first preset value or a second preset value stored by the keyboard filter driver, or when the value of the first key identification is equal to the key state value corresponding to the current keyboard input information, the keyboard filter driver corrects the first key identification in the current keyboard input information according to a third preset value stored by the keyboard filter driver, and updates the correction identification to a default identification;
correspondingly, in the above method, the updating of the correction identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information by the keyboard filter driver specifically includes: and when the value of the first key identification is not equal to the value of the third key identification in the corresponding information record, or when the value of the first key identification is not equal to the key state value corresponding to the current keyboard input information, or when the value of the first key identification is not the first preset value or the second preset value stored by the keyboard filter driver, the keyboard filter driver updates the correction identification stored by the keyboard filter driver to the preset non-default identification.
Specifically, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to a third preset value stored in the keyboard filter driver, specifically: and the keyboard filter driver performs bit OR operation on the value of the first key identifier and a third preset value stored by the keyboard filter driver, and updates the first key identifier by using an operation result.
Specifically, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to a third preset value stored in the keyboard filter driver, specifically: and the keyboard filter driver performs addition operation on the value of the first key identifier and a third preset value stored by the keyboard filter driver, and updates the first key identifier by using an operation result.
Optionally, in the method of this embodiment, the step S3-step S4 specifically include:
step a1: the keyboard filter driver judges whether the correction identification stored by the keyboard filter driver is a default identification;
when the keyboard filter driver judges that the correction identifier stored by the keyboard filter driver is not the default identifier, executing the step a 2;
step a 2: correcting a first key identification in current keyboard input information by the keyboard filter driver, and updating the correction identification into a default identification;
step a 3: the keyboard filter driver judges whether the corrected current keyboard input information is interference information, if so, the step a4 is executed, otherwise, the step a5 is executed;
step a 4: the keyboard filter driver updates the correction identifier stored by the keyboard filter driver according to the first key identifier in the corrected current keyboard input information, and removes the corrected current keyboard input information from the keyboard input data;
step a 5: and the keyboard filter driver stores the corrected current keyboard input information into a corresponding position in the keyboard input data.
Optionally, in the above method, the correction identifier is a second key identifier stored in the keyboard filter driver, and the default identifier is a default key identifier;
in the step a2, the keyboard filter driver corrects the first key identifier in the current keyboard input information, and updates the correction identifier to the default identifier, specifically: and the keyboard filter driver corrects the first key identification in the current keyboard input information according to the second key identification stored by the keyboard filter driver, and updates the second key identification into the default key identification.
Specifically, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored in the keyboard filter driver, specifically: the keyboard filter driver adds the value of the second key identifier and the value of the first key identifier, and updates the first key identifier by using the operation result;
correspondingly, in step a4, the updating, by the keyboard filter driver, the correction identifier stored in the keyboard filter driver according to the first key identifier in the corrected current keyboard input information specifically includes: the keyboard filter driver subtracts the corresponding key state value from the value of the first key identifier in the corrected current keyboard input information, and updates the second key identifier by using the operation result;
in step S5, the keyboard filter driver updates the correction identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information, specifically: and the keyboard filter driver subtracts the corresponding key state value from the value of the first key identifier in the current keyboard input information, and updates the second key identifier stored by the keyboard filter driver by using the operation result.
Specifically, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored in the keyboard filter driver, specifically: the keyboard filter driver performs bit OR operation on the value of the second key identifier and the value of the first key identifier, and updates the first key identifier by using an operation result;
correspondingly, in step a4, the updating, by the keyboard filter driver, the correction identifier stored in the keyboard filter driver according to the first key identifier in the corrected current keyboard input information specifically includes: the keyboard filter driver inverts the key state value corresponding to the corrected current keyboard input information, performs bit AND operation on the inverted result and the value of the first key identifier in the corrected current keyboard input information, and updates the second key identifier stored by the keyboard filter driver by using the operation result;
in step S5, the keyboard filter driver updates the correction identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information, specifically: and the keyboard filter driver inverts the key state value corresponding to the current keyboard input information, performs bit and operation on the inverted result and the value of the first key identifier in the current keyboard input information, and updates the second key identifier stored by the keyboard filter driver by using the operation result.
Specifically, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored in the keyboard filter driver, specifically: when the value of the first key identification is a first preset value or a second preset value stored by the keyboard filter driver, or when the value of the first key identification is equal to the key state value corresponding to the current keyboard input information, the keyboard filter driver updates the first key identification in the current keyboard input information by using the second key identification stored by the keyboard filter driver;
correspondingly, in step a4, the updating, by the keyboard filter driver, the correction identifier stored in the keyboard filter driver according to the first key identifier in the corrected current keyboard input information specifically includes: the keyboard filter driver updates a second key identifier stored by the keyboard filter driver by using the first key identifier;
in step S5, the keyboard filter driver updates the correction identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information, specifically: and when the first key identification is not the first preset value or the second preset value stored by the keyboard filter driver, or when the value of the first key identification is not equal to the key state value corresponding to the current keyboard input information, or when the value of the first key identification is not equal to the value of the third key identification in the corresponding information record, the keyboard filter driver updates the second key identification stored by the keyboard filter driver by using the first key identification.
Optionally, in step a2, the keyboard filter driver corrects the first key identifier in the current keyboard input information, and updates the correction identifier to the default identifier, specifically: when the value of the first key identification is a first preset value or a second preset value stored by the keyboard filter driver, or when the value of the first key identification is equal to the key state value corresponding to the current keyboard input information, the keyboard filter driver corrects the first key identification in the current keyboard input information according to a third preset value stored by the keyboard filter driver, and updates the correction identification to a default identification;
correspondingly, in step a4, the updating, by the keyboard filter driver, the correction identifier stored in the keyboard filter driver according to the first key identifier in the corrected current keyboard input information specifically includes: the keyboard filter driver updates the correction identification stored by the keyboard filter driver into a preset non-default identification;
in step S5, the keyboard filter driver updates the correction identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information, specifically: and when the value of the first key identification is not equal to the value of the third key identification in the corresponding information record, or when the value of the first key identification is not equal to the key state value corresponding to the current keyboard input information, or when the first key identification is not the first preset value or the second preset value stored by the keyboard filter driver, the keyboard filter driver updates the correction identification stored by the keyboard filter driver to the preset non-default identification.
Specifically, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to a third preset value stored in the keyboard filter driver, specifically: and the keyboard filter driver performs bit OR operation on the value of the first key identifier and a third preset value stored by the keyboard filter driver, and updates the first key identifier by using an operation result.
Specifically, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to a third preset value stored in the keyboard filter driver, specifically: and the keyboard filter driver performs addition operation on the value of the first key identifier and a third preset value stored by the keyboard filter driver, and updates the first key identifier by using an operation result.
In this embodiment, after the step S2, the method further includes:
when the correction identifier stored by the keyboard filter driver is the default identifier and the current keyboard input information is not interference information, executing step S6;
step S6: the keyboard filter driver stores the current keyboard input information to the corresponding position in the keyboard input data.
Compared with the prior art, the invention has the beneficial effects that: the keyboard filter driver acquires the keyboard input data from the system, and after acquiring the current keyboard input information from the keyboard input data, the keyboard filter driver processes the current keyboard input information according to the acquired current keyboard input information and the correction identifier stored by the keyboard filter driver, so that the keyboard input accuracy is improved; the keyboard filter driver waits for the controller to be idle before sending the analog keyboard input data to the controller, so that the analog keyboard input data can be prevented from covering the data in the controller, and the data in the controller before the keyboard filter driver sends the analog keyboard input data to the controller is guaranteed to be effective.
Example 2
The present embodiment provides a method for improving keyboard input correctness, as shown in fig. 2, including the following steps:
step S21: the keyboard filter driver acquires keyboard input data from the system and acquires current keyboard input information from the keyboard input data;
in this embodiment, after the PS2 keyboard sends the PS2 keyboard input data to the controller, the system extracts the PS2 keyboard input data from the controller, processes the extracted PS2 keyboard input data to generate keyboard input information, and stores the keyboard input information in the keyboard input data. After the keyboard filter driver sends the simulated keyboard input data to the controller, the system takes out the simulated keyboard input data from the controller, processes the taken-out simulated keyboard input data to generate keyboard input information, and stores the keyboard input information into the keyboard input data.
Specifically, the current KEYBOARD input information obtained by the KEYBOARD filter driver from the KEYBOARD input DATA is specifically keyplane _ input _ DATA structure DATA.
For example, the KEYBOARD _ NIPUT _ DATA structure DATA is as follows:
USHORT UnitId; // location number corresponding to keyboard device
USHORT MakeCode; // Key scan code, i.e. Key value
USHORT Flags; // first Key identification
Wherein, the Unitld value corresponding to the PS2 keyboard is 0; the PS2 keyboard includes a non-expansion key and an expansion key, where when the non-expansion key is pressed, the flag in the keyboard input information obtained after the system processing is 0, and when the non-expansion key bounces, the flag in the keyboard input information obtained after the system processing is 1; when the expansion key is pressed, the flag in the keyboard input information obtained after the system processing is 2, and when the expansion key is bounced, the flag in the keyboard input information obtained after the system processing is 3.
In this embodiment, the key state value corresponding to the current keyboard input information is also recorded in the key identification Flags in the current keyboard input information.
Specifically, the key state value corresponding to the current keyboard input information is the value of the first digit in the first key identifier. For example, when the value of the first key identifier in the current keyboard input information is flag 0 (binary number of 0 is 00, value of the first digit is 0) or flag 2 (binary number of 2 is 10, value of the first digit is 0), the corresponding key state value is 0; when the value of the first key identifier in the current keyboard input information is flag 1 (the binary number of 1 is 01, and the value of the first digit is 1) or flag 3 (the binary number of 3 is 11, and the value of the first digit is 1), the corresponding key state value is 1.
For example, when the letter a on the PS2 keyboard is pressed, the keyboard input information is obtained after being processed by the system, the system stores the keyboard input information into the keyboard input data, the keyboard filter driver obtains the keyboard input data from the system, and the corresponding current keyboard input information obtained from the keyboard input data is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=0;
when the letter a on the PS2 keyboard is bounced, the keyboard input information is obtained after the processing by the system, the system stores the keyboard input information in the keyboard input data, the keyboard filter driver obtains the keyboard input data from the system, and the corresponding current keyboard input information obtained from the keyboard input data is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=1;
wherein, the value of the key scanning code of the letter a on the PS2 keyboard is: MakeCode ═ 0x1 e.
Step S22: the keyboard filter driver judges whether the current keyboard input information is interference information, if so, the step S25 is executed, otherwise, the step S23 is executed;
specifically, the keyboard filter driver determines whether the current keyboard input information is interference information, specifically: and the keyboard filter driver judges whether the information record corresponding to the current keyboard input information exists, if so, the information record is interference information, otherwise, the information record is not interference information.
Step S23: the keyboard filter driver judges whether a second key identification stored by the keyboard filter driver is a default key identification, and if so, the current keyboard input information is stored in a corresponding position in the keyboard input data; otherwise, step S24 is executed.
For example, the value of the default key identifier is 0, and the keyboard filter driver determines whether the second key identifier stored by the keyboard filter driver is the default key identifier, specifically, the keyboard filter driver determines whether the value of the second key identifier stored by the keyboard filter driver is 0.
And step S24, the keyboard filter driver corrects the first key identification in the current keyboard input information according to the second key identification stored by the keyboard filter driver, updates the second key identification stored by the keyboard filter driver to the default key identification, and stores the corrected current keyboard input information to the corresponding position in the keyboard input data.
Step S25: and the keyboard filter driver judges whether the second key identification stored by the keyboard filter driver is the default key identification, if so, the step S26 is executed, otherwise, the current keyboard input information is removed from the keyboard input data.
For example, the value of the default key identifier is 0, and the keyboard filter driver determines whether the second key identifier stored by the keyboard filter driver is the default key identifier, specifically, the keyboard filter driver determines whether the value of the second key identifier stored by the keyboard filter driver is 0.
Step S26: and the keyboard filter driver updates a second key identifier stored by the keyboard filter driver according to the first key identifier in the current keyboard input information, and removes the current keyboard input information from the keyboard input data.
Optionally, in step S24, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored in the keyboard filter driver, specifically: the keyboard filter driver adds the value of the second key identification stored by the keyboard filter driver to the value of the first key identification, and updates the first key identification by using the operation result;
for example, the value of the second key identifier stored by the keyboard filter driver is 2, and the current keyboard input information obtained from the keyboard input data is:
UnitId=0;
MakeCode=0x1e;
Flags=0;
namely, the value of the first key identifier is 0, the key state value corresponding to the current keyboard input information is 0, the keyboard filter driver adds the value 2 of the second key identifier to the value 0 of the first key identifier, the first key identifier in the current keyboard input information is updated by using the operation result 2, the value of the updated first key identifier is 2, and the corrected current keyboard input information is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=2;
namely, the value of the first key identification in the corrected current keyboard input information is 2, and the corresponding key state value is 0;
correspondingly, in step S26, the keyboard filter driver updates the second key identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information, specifically: the keyboard filter driver subtracts a key state value corresponding to current keyboard input information from a value of the first key identifier, and updates a second key identifier stored by the keyboard filter driver by using an operation result;
for example, the second key identifier stored by the keyboard filter driver is a default key identifier, the value of the default key identifier is 0, and the current keyboard input information acquired by the keyboard filter driver is as follows:
UnitId=0;
MakeCode=0x35;
Flags=3;
the value of a first key identification in current keyboard input information is 3, the key state value corresponding to the current keyboard input information is 1, the keyboard filter driver subtracts the value of the first key identification from the value of the first key identification by the value of the first key state value 1, and the operation result 2 is used for updating a second key identification stored by the keyboard filter driver, namely the value of the updated second key identification is 2.
Optionally, in step S24, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored in the keyboard filter driver, specifically: the keyboard filter driver performs bit OR operation on the value of the second key identifier and the value of the first key identifier, and updates the first key identifier by using an operation result;
for example, the value of the second key identifier stored by the keyboard filter driver is 2, and the obtained current keyboard input information is:
UnitId=0;
MakeCode=0x1e;
Flags=0;
namely, the value of the first key identifier is 0, and the key state value corresponding to the current keyboard input information is 0; the keyboard filter driver performs bit or operation on the value 2 of the second key identifier and the value 0 of the first key identifier (the binary number of 2 is 00000010, the binary number of 0 is 00000000, and 00000010 and 00000000 perform bit or operation to obtain 00000010), the operation result 2 is used to update the first key identifier, and the corrected current keyboard input information is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=2;
namely, the value of the first key identifier in the corrected current keyboard input information is 2 (the corresponding binary number is 00000010);
correspondingly, in step S26, the keyboard filter driver updates the second key identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information, specifically: and the keyboard filter driver inverts the key state value corresponding to the current keyboard input information, performs bit AND operation on the inverted result and the value of the first key identifier in the current keyboard input information, and updates the second key identifier by using the operation result.
For example, the value of the second key identifier stored by the keyboard filter driver is a default key identifier, the value of the default key identifier is 0, and the current keyboard input information acquired by the keyboard filter driver is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=2;
the value of the first key identification in the current keyboard input information is 2, the key state value corresponding to the current keyboard input information is 0, the keyboard filter driver inverts the key state value 00000000 corresponding to the current keyboard input information, the inversion result 11111111 and the value 00000010 of the first key identification in the current keyboard input information are subjected to bit AND operation, the operation result 00000010 is used for updating the second key identification, and the value of the updated second key identification is 2 (the binary system of 2 is 00000010).
Optionally, after the step S23 and before the step S24, the method further includes:
step h 1: the keyboard filter driver judges whether the first key identification in the current keyboard input information is a first preset value or a second preset value stored by the keyboard filter driver, if so, the step S24 is executed, otherwise, the current keyboard input information is stored in a corresponding position in the keyboard input data;
correspondingly, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored in the keyboard filter driver in step S24, specifically: when the first key identification is a first preset value or a second preset value, the keyboard filter driver updates the first key identification in the current keyboard input information by using the second key identification stored by the keyboard filter driver;
for example, the first preset value is 0, the second preset value is 1, the value of the second key identifier stored by the keyboard filter driver is 2, and the current keyboard input information acquired by the keyboard filter driver from the system is:
UnitId=0;
MakeCode=0x1e;
Flags=0;
namely, the value of the first key identifier in the current keyboard input information is 0, the keyboard filter driver updates the first key identifier by using the second key identifier stored by the keyboard filter driver, the value of the updated first key identifier is 2, and the corrected current keyboard input information is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=2;
accordingly, the steps S25 and S26 are followed by:
step h 2: the keyboard filter driver judges whether the value of the first key identifier in the current keyboard input information is the first preset value or the second preset value stored by the keyboard filter driver, if yes, the current keyboard input information is removed from the keyboard input data, and if not, the step S26 is executed.
In step S26, the keyboard filter driver updates the second key identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information, specifically: when the value of the first key identification is not the first preset value or the second preset value, the keyboard filter driver updates the second key identification stored by the keyboard filter driver by using the first key identification;
for example, the first preset value is 0, the second preset value is 1, the value of the second key identifier stored by the keyboard filter driver is 0, and the current keyboard input information acquired by the keyboard filter driver is:
UnitId=0;
MakeCode=0x1e;
Flags=2;
namely, the value of the first key identifier is 2, the keyboard filter driver updates the second key identifier by using the value 2 of the first key identifier, and the value of the updated second key identifier is 2.
Optionally, in this embodiment, the step h1 may further be:
step c 1: and the keyboard filter driver judges whether the first key identification in the current keyboard input information is equal to the key state value corresponding to the current keyboard input information, if so, the step S24 is executed, otherwise, the current keyboard input information is stored in the corresponding position in the keyboard input data.
Correspondingly, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored in the keyboard filter driver in step S24, specifically: and when the first key identification is equal to the key state value corresponding to the current keyboard input information, the keyboard filter driver updates the first key identification in the current keyboard input information by using the second key identification stored by the keyboard filter driver.
Optionally, the step h2 may further be:
step c 2: the keyboard filter driver determines whether the value of the first key identifier in the current keyboard input information is equal to the key state value corresponding to the current keyboard input information, if yes, the current keyboard input information is removed from the keyboard input data, otherwise, step S26 is executed.
Specifically, the keyboard filter driver determines whether a value of a first key identifier in current keyboard input information is equal to a key state value corresponding to the current keyboard input information, specifically: the keyboard filter driver judges whether the value of the first key identifier is equal to the value of the first digit of the first key identifier.
Correspondingly, in step S26, the keyboard filter driver updates the second key identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information, specifically: when the value of the first key identification in the current keyboard input information is not equal to the key state value corresponding to the current keyboard input information, the keyboard filter driver updates the second key identification stored by the keyboard filter driver by using the first key identification.
Optionally, the step h2 may further be:
step c 3: and the keyboard filter driver judges whether the value of the first key identifier in the current keyboard input information is equal to the value of the third key identifier in the corresponding information record, if so, the current keyboard input information is removed from the keyboard input data, and if not, the step S26 is executed.
Correspondingly, in step S26, the keyboard filter driver updates the second key identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information, specifically: and when the value of the first key identification in the current keyboard input information is not equal to the value of the third key identification in the corresponding information record, the keyboard filter driver updates the second key identification stored by the keyboard filter driver by using the first key identification.
Optionally, in the method of this embodiment, the method further includes:
step N1: the keyboard filter driver sends a keyboard input prohibition instruction to the controller;
in this embodiment, after the keypad filter driver sends the keyboard input disable command to the controller, the PS2 keypad is unable to send PS2 keypad input data to the controller.
Specifically, the keyboard filter driver sends a keyboard input prohibition instruction to the controller through the PORT function WRITE _ PORT _ UCHAR.
For example, the port function is: WRITE _ PORT _ UCHAR (0x64,0 xAD); wherein, WRITE _ PORT _ UCHAR is the PORT function name, parameter 0x64 is the controller command PORT address, and parameter 0xAD is the command for prohibiting keyboard input.
Step N2: the keyboard filter driver sends analog keyboard input data to the controller, the analog keyboard input data are transmitted to the system through the controller, the analog keyboard input data are processed through the system to obtain keyboard input information, and the keyboard input information is stored in the keyboard input data;
in step N2, after the keyboard filter driver sends the simulated keyboard input data to the controller, the method further includes: the keypad filter driver sends a keypad enable command to the controller.
Specifically, the keyboard filter driver sends a command allowing keyboard input to the controller, specifically: the keyboard filter driver sends a command for allowing keyboard input to the controller through a PORT function WRITE _ PORT _ UCHAR;
for example, the port function is as follows: WRITE _ PORT _ UCHAR (0x64,0 xae); wherein, WRITE _ PORT _ UCHAR is the PORT function name, parameter 0x64 is the controller command PORT address, and parameter 0xae is the permission of keyboard input command.
Optionally, before the step N1, the method further includes: the keypad filter driver waits for the controller to idle.
Specifically, the method comprises the following steps: the keyboard filter driver waits for the controller command port 0x64 to be idle by running the port function waitforkeyboardwritecectl. If the controller commands port 0x64 to be idle, the keyboard filter driver stops running the port function WaitForKeyboardWriteCTL, and executes step N1; otherwise, the operation of the port function WaitForKeyboardWriteCTL is continued.
Specifically, the keyboard filter driver waits for the controller to command the port 0x64 to be idle by running the port function waitforkeyboardwritecectl, specifically including:
step L1: the keyboard filter driver reads the state of the controller port by operating the port function;
for example, the keyboard filter driver READs the status of the controller PORT by running the PORT function waitforkeyboardwritecectl to be READ _ PORT _ UCHAR (0x64), 0x64 is the controller PORT address;
step L2: the keyboard filter driver judges whether the controller port is idle according to the state of the controller port, if so, the step N1 is executed; otherwise, returning to the step L1;
wherein, the keyboard filters the state judgement controller port according to the controller port of the drive and whether idle, specifically is: the keyboard filter driver judges whether the data of the lowest two bits in the controller is taken away or not according to the state of the port of the controller, if so, the keyboard filter driver is idle, otherwise, the keyboard filter driver is not idle;
for example, the keyboard filter driver determines whether READ _ PORT _ UCHAR (0x64) &0x3 is 0, if yes, the lowest two bits in the controller have been taken away, and the controller is idle; otherwise, the lowest two bits in the controller are not taken away, and the controller is not idle.
In this embodiment, the keyboard filter driver waits for the controller to be idle before sending the simulated keyboard input data to the controller in order to avoid overwriting the PS2 keyboard input data in the controller.
Further, after the keyboard filter driver sends the simulated keyboard input data to the controller, the method further comprises: the keyboard filter driver starts an interference information event;
accordingly, before step S22, the method further includes: the keyboard filter driver judges whether to start the interference information event, if so, the step S22 is executed, otherwise, the step S23 is executed;
in step S25, when the keyboard filter driver determines that the key identifier stored in the keyboard filter driver is not the default key identifier, the method further includes: the keyboard filters and drives and closes the interference information event;
step S26 further includes: the interference information event is turned off.
Optionally, after the keyboard filter driver sends the simulated keyboard input data to the controller in step N2, the method further includes: generating and storing information records by a keyboard filter driver;
specifically, the information record includes a key scan code and a third key identifier.
In step S21, when the current keyboard input information acquired by the keyboard filter driver is interference information, the information record corresponding to the current keyboard input information is recorded.
Accordingly, the keyboard filter driver in step S22 determines whether the keyboard input information is interference information, specifically: the keyboard filter driver judges whether information records corresponding to current keyboard input information are stored, if so, the information records are interference information, otherwise, the information records are not interference information;
specifically, the keyboard filter driver determines whether an information record corresponding to current keyboard input information is stored, specifically: and the keyboard filter driver judges whether the value of the key scanning code in the current keyboard input information is equal to the value of the key scanning code in the corresponding information record, if so, the keyboard filter driver has the information record corresponding to the current keyboard input information, and otherwise, the keyboard filter driver does not have the information record corresponding to the current keyboard input information.
Optionally, in step S26, the method further includes: the keyboard filter driver clears the information record corresponding to the current keyboard input information;
in the step S25, when the keyboard filter driver determines that the second key identifier stored in the keyboard filter driver is not the default key identifier, the method further includes: the keyboard filter driver clears the information record corresponding to the current keyboard input information.
Optionally, in step S21, after the keyboard filter driver obtains the keyboard input data from the system and before obtaining the current keyboard input information from the keyboard input data, the method further includes: the keyboard filter driver calculates the number of keyboard input information in the keyboard input data;
correspondingly, before the keyboard filter driver obtains the current keyboard input information from the keyboard input data, the method further comprises the following steps:
m1, the keyboard filter driver judges whether the cycle number is less than the number of the keyboard input information, if yes, the current keyboard input information is obtained from the keyboard input data, otherwise, the keyboard input data is returned to the system;
after the keyboard filter driver processes the current keyboard input information obtained from the keyboard input data each time, the method further comprises the following steps:
step m 2: the keyboard filter driver adds one to the cycle number and returns to the step m 1;
when the keyboard filter driver is initialized, the keyboard filter driver sets the cycle number as an initial value. For example, the initial value is 0.
In this embodiment, the keyboard filter driver executes step m2 after processing the current keyboard input information acquired from the keyboard input data each time, specifically: step m2 is executed after step S26, step m2 is executed after step S24, step m2 is executed after the keyboard filter driver removes the current keyboard input information from the keyboard input data, and step m2 is executed after the keyboard filter driver saves the current keyboard input information to the corresponding position in the keyboard input data.
Specifically, the keyboard filter driver calculates the number of keyboard input information in the keyboard input data, specifically: the keyboard filter driver uses a positive integer obtained by dividing the data length of the keyboard input data by the data length of the single keyboard input information in the keyboard input data.
In this embodiment, the keyboard filter driver sends the keyboard input data acquired from the system, specifically, the upper layer application to the system. Accordingly, after the keyboard filter driver returns the keyboard input data to the system, the system returns the data in the keyboard input information to the corresponding upper-layer application.
Optionally, in this embodiment, the order of the keyboard filter driver determining whether the current keyboard input information is interference information and the order of the keyboard filter driver determining whether the second key identifier stored in the keyboard filter driver is the default key identifier may be changed, that is, the order of steps S21 to S26 may be step M1 to step M6, and the specific steps M1 to step M6 are as follows:
step M1: the keyboard filter driver acquires keyboard input data from the system and acquires current keyboard input information from the keyboard input data;
step M2: the keyboard filter driver judges whether the second key identification stored by the keyboard filter driver is the default key identification, if so, the step M3 is executed; otherwise, executing step M5;
step M3: the keyboard filter driver judges whether the current keyboard input information is interference information, if so, the step M4 is executed, otherwise, the current keyboard input information is stored in the corresponding position in the keyboard input data;
specifically, step M3 is the same as step S22, and is not repeated here.
And step M4, the keyboard filter driver updates the second key identification stored by the keyboard filter driver according to the first key identification in the current keyboard input information and removes the current keyboard input information from the keyboard input data.
Specifically, step M4 is the same as step S26, and is not repeated here.
Step M5: the keyboard filter driver judges whether the current keyboard input information is interference information, if so, the current keyboard input information is removed from the keyboard input data, otherwise, the step M6 is executed;
specifically, step M5 is the same as step S22, and is not repeated here.
Step M6: the keyboard filter driver corrects a first key identification in the current keyboard input information according to a second key identification stored by the keyboard filter driver, updates the second key identification stored by the keyboard filter driver to a default key identification, and stores the corrected current keyboard input information to a corresponding position in the keyboard input data;
specifically, step M6 is the same as step S24, and is not repeated here.
Optionally, in this embodiment, the steps S22 to S26 may also be steps a1 to a 7:
step a1: the keyboard filter driver judges whether the second key identification stored by the keyboard filter driver is the default key identification, if so, the step a6 is executed, otherwise, the step a2 is executed;
specifically, the determination of whether the second key identifier saved by the keyboard filter driver in step a1 is the default key identifier is the same as the step S25 and the step S23, and details thereof are not repeated herein.
Step a 2: the keyboard filter driver corrects the first key identification in the current keyboard input information according to the second key identification stored by the keyboard filter driver, and updates the second key identification into a default key identification;
step a 3: the keyboard filter driver judges whether the corrected current keyboard input information is interference information, if so, the step a4 is executed, otherwise, the step a5 is executed;
in step a3, the keyboard filter driver determines whether the corrected current keyboard input information is interference information, which is the same as the keyboard filter driver determines whether the current keyboard input information is interference information in step S22, and is not repeated here.
Step a 4: the keyboard filter driver updates a second key identification stored by the keyboard filter driver according to the first key identification in the corrected current keyboard input information, and removes the corrected current keyboard input information from the keyboard input data;
step a 5: the keyboard filter driver stores the corrected current keyboard input information to a corresponding position in the keyboard input data;
step a 6: the keyboard filter driver judges whether the current keyboard input information is interference information, if so, the step a7 is executed, otherwise, the step a8 is executed;
the keyboard filter driver determines whether the current keyboard input information is interference information in step a6, which is the same as the keyboard filter driver determines whether the current keyboard input information is interference information in step S22, and is not repeated here.
Step a 7: the keyboard filter driver updates a second key identifier stored by the keyboard filter driver according to the first key identifier in the current keyboard input information, and removes the current keyboard input information from the keyboard input data;
step a 8: the keyboard filter driver stores the current keyboard input information to the corresponding position in the keyboard input data.
Optionally, in step a2, the correcting, by the keyboard filter driver, the first key identifier in the current keyboard input information according to the second key identifier stored in the keyboard filter driver includes: the keyboard filter driver adds the value of the second key identifier and the value of the first key identifier, and updates the first key identifier by using the operation result;
for example, the value of the second key identifier stored by the keyboard filter driver is 2, and the keyboard input information acquired from the system is:
UnitId=0;
MakeCode=0x1e;
Flags=0;
namely, the value of the first key identifier is 0, the corresponding key state value is 0, the keyboard filter driver adds the value 2 of the second key identifier to the value 0 of the first key identifier, the first key identifier in the current keyboard input information is updated by using the operation result, the value of the updated first key identifier is 2, and the corrected keyboard input information is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=2;
that is, the value of the first key identifier in the corrected current keyboard input information is 2, and the corresponding key state value is 0.
Correspondingly, in step a4, the updating, by the keyboard filter driver, the second key identifier stored in the keyboard filter driver according to the first key identifier in the corrected current keyboard input information specifically includes: and the keyboard filter driver subtracts the corresponding key state value from the value of the first key identifier in the corrected current keyboard input information, and updates the second key identifier stored by the keyboard filter driver by using the operation result.
For example, the keyboard filter driver subtracts the corresponding key state value 0 from the value 2 of the first key identifier in the corrected current keyboard input information, updates the second key identifier stored in the keyboard filter driver by using the operation result 2, and after the updating, the value of the second key identifier stored in the keyboard filter driver is 2.
In the step a7, the updating, by the keyboard filter driver, the second key identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information specifically includes: and the keyboard filter driver subtracts the corresponding key state value from the value of the first key identifier in the current keyboard input information, and updates the second key identifier by using the operation result.
For example, the second key identifier stored by the keyboard filter driver is a default key identifier, the value of the default key identifier is 0, and the current keyboard input information acquired by the keyboard filter driver is as follows:
UnitId=0;
MakeCode=0x35;
Flags=3;
the value of the first key identification in the current keyboard input information is 3, the corresponding key state value is 1, the keyboard filter driver subtracts the value 3 of the first key identification from the corresponding key state value 1, and the operation result 2 is used for updating the second key identification stored by the keyboard filter driver, namely the value of the updated second key identification is 2.
Optionally, in step a2, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored in the keyboard filter driver, specifically: the keyboard filter driver performs bit OR operation on the value of the second key identifier and the value of the first key identifier, and updates the first key identifier by using an operation result;
for example, the value of the second key identifier stored by the keyboard filter driver is 2, and the keyboard input information acquired from the system is:
UnitId=0;
MakeCode=0x1e;
Flags=0;
namely, the value of the first key identification is 0, and the key state value corresponding to the keyboard input information is 0; the keyboard filter driver performs bit or operation on the value 2 of the second key identifier and the value 0 of the first key identifier (the binary number of 2 is 00000011, the binary number of 0 is 00000000, and 00000010 and 00000000 perform bit or operation to obtain 00000010), the operation result 2 is used to update the first key identifier, and the corrected keyboard input information is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=2;
namely, the value of the first key identifier in the corrected keyboard input information is 2 (the corresponding binary number is 00000010);
correspondingly, in step a4, the keyboard filter driver updates the second key identifier stored in the keyboard filter driver according to the first key identifier in the corrected current keyboard input information, specifically: the keyboard filter driver inverts the key state value corresponding to the corrected current keyboard input information, performs bit AND operation on the inverted result and the value of the first key identifier in the corrected current keyboard input information, and updates the second key identifier by using the operation result;
for example, the value of the first key identifier in the corrected current keyboard input information is 2, the key state value corresponding to the corrected current keyboard input information is 0, the keyboard filter driver inverts the key state value 00000000 corresponding to the corrected current keyboard input information, the inverted result 11111111111 and the value 00000010 of the first key identifier in the corrected current keyboard input information are subjected to bit and operation, the operation result 00000010 is used to update the second key identifier, and the updated value of the second key identifier is 2 (the binary value of 2 is 00000010).
In step a7, the keyboard filter driver updates the second key identifier stored by the keyboard filter driver according to the first key identifier in the current keyboard input information, specifically: and the keyboard filter driver inverts the key state value corresponding to the current keyboard input information, performs bit AND operation on the inverted result and the value of the first key identifier in the current keyboard input information, and updates the second key identifier by using the operation result.
For example, the current keyboard input information obtained by the keyboard filter driver is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=2;
the value of the first key identification in the current keyboard input information is 2, then the key state value corresponding to the current keyboard input information is 0, the keyboard filter driver inverts the key state value 00000000 corresponding to the current keyboard input information, the inversion result 11111111 and the value 00000010 of the first key identification in the current keyboard input information are subjected to bit and operation, the operation result 00000010 is used for updating the second key identification, and the updated value of the second key identification is 2 (the binary system of 2 is 00000010).
Optionally, before the step a2, the method further includes:
and step W1, the keyboard filter driver judges whether the value of the first key identifier in the current keyboard input information is the first preset value or the second preset value stored by the keyboard filter driver, if so, the step a2 is executed.
In step a2, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored by the keyboard filter driver, specifically: when the value of the first key identification is a first preset value or a second preset value, the keyboard filter driver updates the first key identification in the current keyboard input information by using the second key identification stored by the keyboard filter driver;
for example, the first preset value is 0, the second preset value is 1, the value of the second key identifier stored by the keyboard filter driver is 2, and the current keyboard input information acquired by the keyboard filter driver from the system is:
UnitId=0;
MakeCode=0x1e;
Flags=0;
namely, the value of the first key identifier in the current keyboard input information is 0, the keyboard filter driver updates the first key identifier by using the second key identifier stored by the keyboard filter driver, the value of the updated first key identifier is 2, and the corrected current keyboard input information is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=2;
correspondingly, in step a4, the keyboard filter driver updates the second key identifier stored in the keyboard filter driver according to the first key identifier in the corrected current keyboard input information, specifically: the keyboard filter driver updates a second key identification stored by the keyboard filter driver by using the corrected first key identification;
for example, the keyboard filter driver updates the value of the second key identifier stored in the keyboard filter driver by using the corrected value 2 of the first key identifier, and the value of the second key identifier is 2 after updating.
Correspondingly, before the step a7, the method further includes:
step W2: and the keyboard filter driver judges whether the value of the first key identifier in the current keyboard input information is a first preset value or a second preset value stored by the keyboard filter driver, if so, the current keyboard input information is removed from the keyboard input data, and if not, the step a7 is executed.
In step a7, the keyboard filter driver updates the second key identifier stored by the keyboard filter driver according to the first key identifier in the current keyboard input information, specifically: and when the first key identification is not the first preset value or the second preset value, the keyboard filter driver updates the second key identification stored by the keyboard filter driver by using the first key identification.
For example, the first preset value is 0, the second preset value is 1, the value of the second key identifier stored by the keyboard filter driver is 0, and the keyboard input information acquired from the system is:
UnitId=0;
MakeCode=0x1e;
Flags=2;
namely, the value of the first key identifier is 2, the keyboard filter driver updates the second key identifier by using the value 2 of the first key identifier, and the value of the updated second key identifier is 2.
Optionally, in step W1, when the keyboard filter driver determines that the value of the first key identifier in the current keyboard input information is not the first preset value or the second preset value stored in the keyboard filter driver, the current keyboard input information is stored in the corresponding position in the keyboard input data.
Optionally, in step W1, when the keyboard filter driver determines that the value of the first key identifier in the current keyboard input information is not the first preset value or the second preset value stored in the keyboard filter driver, before the keyboard filter driver stores the current keyboard input information to the corresponding position in the keyboard input data, the method further includes: the keyboard filter driver judges whether the current keyboard input information is interference information, if so, the current keyboard input information is removed from the keyboard input data; otherwise, the current keyboard input information is stored in the corresponding position in the keyboard input data.
Optionally, the step W1 may further include:
step R1: and c, judging whether the value of the first key identification in the current keyboard input information is equal to the key state value corresponding to the current keyboard input information by the keyboard filter driver, if so, executing the step a2, otherwise, storing the keyboard input information in the corresponding position in the keyboard input data.
Correspondingly, in the step a2, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored in the keyboard filter driver, specifically: and when the value of the first key identification is equal to the key state value corresponding to the current keyboard input information, the keyboard filter driver updates the first key identification in the current keyboard input information by using the second key identification stored by the keyboard filter driver.
Optionally, the step W2 may further include:
step R2: and c, the keyboard filter driver judges whether the value of the first key identifier in the current keyboard input information is equal to the key state value corresponding to the current keyboard input information, if so, the current keyboard input information is removed from the keyboard input data, and if not, the step a7 is executed.
Specifically, the keyboard filter driver determines whether a value of a first key identifier in current keyboard input information is equal to a key state value corresponding to the current keyboard input information, specifically: the keyboard filter driver judges whether the value of the first key identifier in the current keyboard input information is equal to the value of the first digit of the first key identifier in the current keyboard input information, if so, the current keyboard input information is removed from the keyboard input data, otherwise, the step a7 is executed;
correspondingly, in the step a7, the updating, by the keyboard filter driver, the second key identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information specifically includes: and when the value of the first key identification is not equal to the key state value corresponding to the current keyboard input information, the keyboard filter driver updates the second key identification stored by the keyboard filter driver by using the first key identification.
Optionally, the step W2 may further include:
step R3: and c, judging whether the value of the first key identification in the current keyboard input information is equal to the value of the third key identification in the corresponding information record by the keyboard filter driver, if so, removing the current keyboard input information from the keyboard input data, otherwise, executing the step a 7.
Correspondingly, in the step a7, the updating, by the keyboard filter driver, the second key identifier stored in the keyboard filter driver according to the first key identifier in the current keyboard input information specifically includes: and when the value of the first key identification is not equal to the value of the third key identification in the corresponding information record, the keyboard filter driver updates the second key identification stored by the keyboard filter driver by using the first key identification.
In the embodiment of the invention, the system comprises a system keyboard bottom layer drive and a system keyboard class drive; the PS2 keyboard may send PS2 keyboard input data to the controller in 1 byte or two bytes, and the keyboard filter driver typically sends analog keyboard input data to the controller in one byte. The controller can only receive one byte of data at a time, and when the PS2 keyboard input data includes two bytes, the PS2 keyboard sends the first byte to the controller including the extra key identification and the second byte to the controller including the key scan code.
In this embodiment, when a key on the PS2 keyboard is pressed, the PS2 keyboard sends corresponding PS2 keyboard input data to the controller, and the system acquires PS2 keyboard input data from the controller and processes the PS2 keyboard input data as follows:
when the non-extension key of the PS2 keyboard is pressed, the PS2 keyboard sends PS2 keyboard input data of 1 byte to the controller, and before the keyboard filter driver takes out the corresponding keyboard input information from the system, the controller and the system process the PS2 keyboard input data, including the following steps:
step A1, the PS2 keyboard sends PS2 keyboard input data to the controller;
step A2: the system keyboard bottom layer driver takes out PS2 keyboard input data from the controller, and processes the PS2 keyboard input data to obtain keyboard input information;
for example, when the PS2 keyboard presses the letter a, the keyboard input information obtained by processing the PS2 keyboard input data by the system keyboard bottom driver is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=0;
step A3: the system keyboard bottom layer driver sends the keyboard input information to the system keyboard class driver through a callback function;
step A4: the system keyboard class driver copies the keyboard input information into the keyboard input data in the IRP.
The IRP in the system keyboard class driver comes from the upper layer application.
Specifically, in the present invention, the keyboard filter driver obtains keyboard input data from a system, specifically: the keyboard filter driver obtains the keyboard input data from the IRP in the system keyboard type disk driver.
When the PS2 keyboard extension key is pressed, PS2 keyboard sends PS2 keyboard input data to the controller as two bytes, and before the keyboard filter driver takes out the keyboard input data from the system, the controller and the system process the PS2 keyboard input data, including the following steps:
step B1, the PS2 keyboard sends the first byte of PS2 keyboard input data to the controller;
step B2: the system keyboard bottom driver takes out the first byte of PS2 keyboard input data from the controller and saves it.
Step B3: the PS2 keyboard sends the second byte of PS2 keyboard input data to the controller;
step B4: and the bottom driver of the system keyboard takes out the data from the controller and processes the data to generate keyboard input information.
After step B2 and before step B3, when the keyboard filter driver does not send the simulated keyboard input data to the controller, the first byte and the second byte of the PS2 keyboard input data are not split, the data fetched by the system keyboard bottom driver from the controller in step B4 is the second byte of the PS2 keyboard input data, and the system keyboard bottom driver processes the first byte and the received second byte of the PS2 keyboard input data to obtain the keyboard input information.
For example, when the PS2 keyboard presses the alphabetic keypad "/", the system keyboard underlying driver processes the second byte of PS2 keyboard input data and the first byte stored, and the resulting keyboard input information is as follows:
UnitId=0;
MakeCode=0x35;
Flags=2;
after the step B2 and before the step B3, when the keyboard filter driver sends the analog keyboard input data to the controller, the first byte and the second byte of the PS2 keyboard input data are split, the data taken out from the controller by the system keyboard bottom driver in the step B4 is the analog keyboard input data, the system keyboard bottom driver processes the stored first byte and the received analog keyboard input data to obtain keyboard input information, and after the keyboard filter driver sends the analog keyboard input data to the controller, the keyboard filter driver generates and stores an information record, where the information record includes a third key identifier and a key scan code.
For example, the value of the key scan code in the input data of the analog keyboard is 0x1e, the system keyboard bottom driver processes the input data of the analog keyboard and the stored first byte, and the obtained keyboard input information is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=2;
after the keyboard filter driver sends the simulated keyboard input data to the controller, an information record is generated and stored, the value of the key scanning code in the information record is 0x1e, the value of the third key identifier is 0, and when the keyboard filter driver acquires the corresponding current keyboard input information, the keyboard filter driver updates the correction identifier stored in the keyboard filter driver according to the received first key identifier flag being 2 (the correction identifier may be specifically the second key identifier).
When the system keyboard bottom layer driver fetches the second byte of the PS2 keyboard input data from the controller, the second byte is processed, and when the keyboard filter driver acquires the corresponding current keyboard input information, the current keyboard input information is corrected according to the correction identifier (the correction identifier may be specifically the second key identifier) stored in the keyboard filter driver.
For example, the system keyboard bottom driver processes the second byte of PS2 keyboard input data, and the obtained keyboard input information is as follows:
UnitId=0;
MakeCode=0x35;
Flags=0;
after the keyboard filter driver acquires the corresponding current keyboard input information, the first key identification Flags in the current keyboard input information are corrected to be 0 according to the correction identification stored in the keyboard filter driver.
Step B5: the system keyboard bottom layer driver sends the keyboard input information to the system keyboard class driver through a callback function;
step B6: the system keyboard class driver copies the keyboard input information to the keyboard input data in the IRP.
In this embodiment, the IRP driven by the system keyboard class comes from an upper application.
Specifically, the keyboard filter driver acquires keyboard input data from the system, specifically: the keyboard filter driver obtains the keyboard input data from the IRP of the system keyboard type disk driver.
In the invention, the keyboard filter driver can send the simulated keyboard input information to the controller at variable time, when the keyboard filter driver sends the simulated keyboard input data to the controller, before the keyboard filter driver takes out the corresponding keyboard input information from the system keyboard driver, the method also comprises the following steps:
step D1: the keyboard filter driver waits for the controller to be idle;
specifically, step D1 is the same as the method for waiting for the controller idle in the keyboard filter driver in this embodiment, and is not described herein again.
Step D2: the keyboard filter driver sends a keyboard input prohibition instruction to the controller.
Specifically, refer to step N1 above, and will not be described herein again.
Step D3: the keyboard filter driver waits for the controller to be idle;
similar to step D1, further description is omitted here.
Step D4: when the controller is idle, the keyboard filter driver sends a data writing instruction to the controller;
specifically, the keyboard filter driver calls a PORT function WRITE _ PORT _ UCHAR to send a WRITE data instruction to the command PORT 0x64 of the controller.
For example, the port function is: WRITE _ PORT _ UCHAR (0x64,0xd 2).
Wherein, WRITE _ PORT _ UCHAR is a PORT function name, parameter 0x64 is a controller command PORT address, and parameter 0xd2 is a WRITE data instruction.
Step D5: the keyboard filter driver waits for the input buffer of the controller to be free.
Specifically, the keyboard filter driver judges whether the controller port is idle by operating the first port function, if so, the input buffer is idle, otherwise, the input buffer is not idle:
for example, the first PORT function is READ _ PORT _ UCHAR (0x64), where the parameter 0x64 is the controller PORT address;
specifically, the keyboard filter driver determines whether the controller port is idle by operating the first port function, specifically: the keyboard filter driver judges whether the second-bit data in the controller is taken away or not by running the first port function, and if the second-bit data is taken away, the keyboard filter driver is idle, otherwise the keyboard filter driver is not idle.
For example, the keypad filter driver determines whether READ _ PORT _ UCHAR (0x64) &0x2 is 0, if so, the second bit data in the controller has been taken away, and the controller is idle; otherwise, the second bit data in the controller is not taken away, the controller is not idle, and whether the port of the controller is idle or not is continuously judged.
D6, the keyboard filter driver sends the analog keyboard input data to the controller, starts the interference information event, generates and saves the information record;
and D7, the bottom driver of the system keyboard takes out the input data of the analog keyboard from the controller and processes the input data of the analog keyboard to obtain the input information of the keyboard.
When no extra key identification is stored in the bottom layer drive of the system keyboard, the value of a first key identification in the keyboard input information obtained after the analog keyboard input data is processed is 0 or 1;
for example, the obtained keyboard input information is:
UnitId=0;
MakeCode=0x82;
Flags=1;
when the extra key identification is stored in the bottom layer drive of the system keyboard, the first key mark in the keyboard input information obtained after processing the input data of the analog keyboard and the extra key identification is not 0 or 1;
for example, the obtained keyboard input information is:
UnitId=0;
MakeCode=0x82;
Flags=3;
step D8: and the system keyboard bottom layer driver sends the keyboard input information to the system keyboard class driver through a callback function.
And D9, copying the keyboard input information to the keyboard input data requested by the IRP by the system keyboard class driver.
In this embodiment, the IRP in the system keyboard class driver comes from an upper layer application.
Specifically, in the present invention, the keyboard filter driver obtains keyboard input information from a system, specifically: the keyboard filter driver obtains the keyboard input data from the IRP of the system keyboard type disk driver.
Compared with the prior art, the invention has the beneficial effects that: when the PS2 keyboard input data includes two bytes, after the PS2 keyboard sends the first byte to the controller, if the keyboard filter driver sends the simulated keyboard input data to the controller, the keyboard filter driver acquires the corresponding keyboard input information, updates the second key identifier stored by the keyboard filter driver according to the acquired current keyboard input information, and when the keyboard filter driver acquires the keyboard input information corresponding to the second byte of the PS2 keyboard input data, corrects the acquired current keyboard input information by using the stored second key identifier, thereby effectively avoiding the second byte and the first byte of the PS2 keyboard input data from being split by the simulated keyboard input data, and ensuring the correctness of the PS2 keyboard input data received by the upper application; after the controller receives the PS2 keyboard input data, before the system keyboard driver takes away the PS2 keyboard input data in the controller, the keyboard filter driver will wait for the controller to be idle and then send the simulated keyboard input data to the controller, so that the simulated keyboard input data can be prevented from covering the PS2 keyboard input data in the controller, and the PS2 keyboard input data is ensured to be effective.
Example 3
The present embodiment provides a method for improving keyboard input correctness, as shown in fig. 3, including:
step S31: the keyboard filter driver acquires keyboard input data from the system and acquires current keyboard input information from the keyboard input data.
Step S31 of this embodiment is the same as step S21 of embodiment 2, and is not repeated here.
Step S32: the keyboard overdrive judges whether the current keyboard input information is interference information, if yes, step S36 is executed; otherwise, step S33 is executed.
Specifically, the keyboard filter driver determines whether the current keyboard input information is interference information, specifically: and the keyboard filter driver judges whether the information record corresponding to the current keyboard input information exists, if so, the information record is interference information, otherwise, the information record is not interference information.
Step S33: the keyboard filter driver judges whether the correction identification stored by the keyboard filter driver is a default identification, and if so, the current keyboard input information is stored in the corresponding position in the keyboard input data; otherwise, step S34 is executed.
For example, the value of the default identifier is 0, and the keyboard filter driver determines whether the correction identifier stored in the keyboard filter driver is the default identifier, specifically, the keyboard filter driver determines whether the value of the correction identifier stored in the keyboard filter driver is 0.
Step S34: the keyboard filter driver judges whether the value of the first key identification in the current keyboard input information is a first preset value or a second preset value stored by the keyboard filter driver, if so, the step S35 is executed, otherwise, the current keyboard input information is stored in a corresponding position in the keyboard input data;
preferably, in this embodiment, the first preset value is 0, and the second preset value is 1.
Optionally, step S34 may also be: the keyboard filter driver judges whether the value of the first key identifier in the current keyboard input information is equal to the key state value corresponding to the current keyboard input information, if so, step S35 is executed, otherwise, the current keyboard input information is stored in the corresponding position in the keyboard input data.
Specifically, the keyboard filter driver determines whether a value of a first key identifier in current keyboard input information is equal to a key state value corresponding to the current keyboard input information, specifically: the keyboard filter driver judges whether the value of the first key identifier is equal to the value of the first digit in the first key identifier, if so, step S35 is executed, otherwise, the current keyboard input information is stored in the corresponding position in the keyboard input data.
Step S35: and the keyboard filter driver corrects the first key identification in the current keyboard input information according to a third preset value stored by the keyboard filter driver, and updates the correction identification into a default identification.
Preferably, the third preset value is 2.
Step S36: the keyboard filter driver judges whether the correction identifier stored by the keyboard filter driver is a default identifier, if so, the step S37 is executed; otherwise, the current keyboard input information is removed from the keyboard input data.
For example, the default flag is 0.
Step S37: and the keyboard filter driver judges whether the value of the first key identifier in the current keyboard input information is equal to the value of the third key identifier in the corresponding information record, if so, the current keyboard input information is removed from the keyboard input data, and if not, the step S38 is executed.
Optionally, step S37 may also be: the keyboard filter driver determines whether the value of the first key identifier in the current keyboard input information is equal to the key state value corresponding to the current keyboard input information, if yes, the current keyboard input information is removed from the keyboard input data, otherwise, step S38 is executed.
Specifically, the keyboard filter driver determines whether the value of the first key identifier in the current keyboard input information is equal to the value of the first digit in the first key identifier, if so, the current keyboard input information is removed from the keyboard input data, otherwise, step S38 is executed.
Optionally, step S37 may also be: and the keyboard filter driver judges whether the value of the first key identifier in the current keyboard input information is equal to a first preset value or a second preset value stored by the keyboard filter driver, if so, the current keyboard input information is removed from the keyboard input data, and if not, the step S38 is executed.
For example, the first preset value is 0, and the second preset value is 1.
Step S38: and the keyboard filter driver updates the correction identifier stored by the keyboard filter driver into a preset non-default identifier, and removes the current keyboard input information from the keyboard input data.
For example, the preset non-default flag is 1.
Optionally, in step S35, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to a third preset value stored in the keyboard filter driver, specifically: and the keyboard filter driver performs bit OR operation on the value of the first key identifier and a third preset value stored by the keyboard filter driver, and updates the first key identifier by using an operation result.
For example, the third preset value stored by the keyboard filter driver itself is 2, and the current keyboard input information obtained from the system keyboard driver is:
UnitId=0;
MakeCode=0x1e;
Flags=0;
namely, the value of the first key identification is 0, and the key state value corresponding to the keyboard input information is 0;
the keyboard filter driver performs bit or operation on a third preset value 2 and a value 0 of the first key identifier (binary number of 2 is 00000011, binary number of 0 is 00000000, and after bit or operation is performed on 00000010 and 00000000, 00000010 and 000000000000, 00000010 is obtained), the first key identifier is updated by using an operation result 2, and the corrected current keyboard input information is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=2;
that is, the value of the first key identifier in the corrected current keyboard input information is 2 (the corresponding binary number is 00000010).
Optionally, in step S35, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to a third preset value stored in the keyboard filter driver, specifically: and the keyboard filter driver performs addition operation on the value of the first key identifier and a third preset value stored by the keyboard filter driver, and updates the first key identifier by using an operation result.
For example, the third preset value is 2, and the keyboard filter driver obtains the following keyboard input information:
UnitId=0;
MakeCode=0x1e;
Flags=0;
namely, the value of the first key identification is 0, the keyboard filter driver performs addition operation on the value 0 of the first key identification and a third preset value 2 stored by the keyboard filter driver, the first key identification is updated by using the operation result 2, and the value of the updated first key identification is 2. The corrected keyboard input information is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=2;
namely, the value of the first key identifier in the corrected current keyboard input information is 2.
Optionally, in the method of this embodiment, the method further includes:
step N1: the keyboard filter driver sends a keyboard input prohibition instruction to the controller;
in this embodiment, step N1 is the same as step N1 in embodiment 2, and is not repeated here.
Step N2: the keyboard filter driver sends analog keyboard input data to the controller, the analog keyboard input data are transmitted to the system through the controller, the analog keyboard input data are processed through the system to obtain keyboard input information, and the keyboard input information is stored in the keyboard input data;
in step N2, after the keyboard filter driver sends the simulated keyboard input data to the controller, the method further includes: the keypad filter driver sends a keypad enable command to the controller.
Specifically, the keyboard filter driver sends a command for allowing keyboard input to the controller through a PORT function WRITE _ PORT _ UCHAR;
for example, the port function is as follows: WRITE _ PORT _ UCHAR (0x64,0 xae); wherein, WRITE _ PORT _ UCHAR is the PORT function name, parameter 0x64 is the controller command PORT address, and parameter 0xae is the permission of keyboard input command.
Optionally, after the keyboard filter driver sends the simulated keyboard input data to the controller in step N2, the method further includes: generating and storing information records by a keyboard filter driver;
specifically, the information record includes a key scan code and a third key identifier.
In step S31, when the current keyboard input information acquired by the keyboard filter driver is interference information, the information record corresponding to the current keyboard input information is recorded.
Accordingly, the keyboard filter driver in step S32 determines whether the keyboard input information is interference information, specifically: the keyboard filter driver judges whether information records corresponding to current keyboard input information are stored, if so, the information records are interference information, otherwise, the information records are not interference information;
specifically, the keyboard filter driver determines whether an information record corresponding to current keyboard input information is stored, specifically: and the keyboard filter driver judges whether the value of the key scanning code in the current keyboard input information is equal to the value of the key scanning code in the corresponding information record, if so, the keyboard filter driver has the information record corresponding to the current keyboard input information, and otherwise, the keyboard filter driver does not have the information record corresponding to the current keyboard input information.
In step S38, the method further includes: the keyboard filter driver clears the information record corresponding to the current keyboard input information;
in the step S36, when the keyboard filter driver determines that the correction flag stored in the keyboard filter driver is the default flag, the method further includes: the keyboard filter driver clears the information record corresponding to the current keyboard input information;
in the step S37, when the keyboard filter driver determines that the value of the first key identifier in the current keyboard input information is not equal to the value of the third key identifier in the corresponding information record, the method further includes: the keyboard filter driver clears the information record corresponding to the current keyboard input information.
Further, step N1 is preceded by: the keypad filter driver waits for the controller to idle.
The method for waiting for the idle of the keyboard filter driver in this embodiment is the same as the method for waiting for the idle of the keyboard filter driver in embodiment 2, and is not described herein again.
In this embodiment, the keyboard filter driver waits for the controller to be idle before sending the simulated keyboard input data to the controller in order to avoid overwriting the PS2 keyboard input data in the controller.
Further, after the keyboard filter driver sends the simulated keyboard input data to the controller, the method further comprises: the keyboard filter driver starts an interference information event;
accordingly, before step S32, the method further includes: the keyboard filter driver judges whether to start the interference information event, if so, the step S32 is executed, otherwise, the step S33 is executed;
in the step S36, when the keyboard filter driver determines that the correction flag stored in the keyboard filter driver is not the default flag, the method further includes: the keyboard filters and drives and closes the interference information event;
in step S37, the method for keyboard filter driver to determine that the value of the first key identifier in the current keyboard input information is equal to the value of the third key identifier in the corresponding information record further includes: the keyboard filters and drives and closes the interference information event;
the step S38 further includes: the interference information event is turned off.
Optionally, in this embodiment, the steps S32 to S38 may also be steps a1 to a 7:
step a1: the keyboard filter driver judges whether the correction identifier stored by the keyboard filter driver is a default identifier, if so, the step a7 is executed, otherwise, the step a2 is executed;
for example, the default flag has a value of 0.
Specifically, the keyboard filter driver determines whether the correction flag stored in the keyboard filter driver is the default flag in step a1, which is the same as the above steps S33 and S36.
Step a 2: the keyboard filter driver judges whether the value of the first key identification in the current keyboard input information is a first preset value or a second preset value, if so, the step a3 is executed, otherwise, the current keyboard input information is stored in the corresponding position in the keyboard input data;
preferably, in this embodiment, the first preset value is 0, and the second preset value is 1.
Optionally, step a2 may also be: and c, judging whether the value of the first key identification in the current keyboard input information is equal to the key state value corresponding to the current keyboard input information by the keyboard filter driver, if so, executing the step a3, otherwise, storing the current keyboard input information to the corresponding position in the keyboard input data.
Specifically, the keyboard filter driver determines whether the value of the first key identifier is equal to the value of the first digit in the first key identifier, if yes, step a3 is executed; otherwise, the current keyboard input information is stored in the corresponding position in the keyboard input data.
Optionally, in the no branch in the step a2, before the keyboard filter driver saves the current keyboard input information to the corresponding location in the keyboard input data, the method further includes: the keyboard filter driver judges whether the current keyboard input information is interference information, if so, the current keyboard input information is removed from the keyboard input data;
correspondingly, the keyboard filter driver stores the current keyboard input information to the corresponding position in the keyboard input data, specifically: and when the keyboard filter driver judges that the current keyboard input information is not interference information, the keyboard filter driver stores the current keyboard input information to a corresponding position in the keyboard input data.
Step a 3: and the keyboard filter driver corrects the first key identification in the current keyboard input information according to a third preset value stored by the keyboard filter driver, and updates the correction identification into a default identification.
Step a 4: the keyboard filter driver judges whether the corrected current keyboard input information is interference information, if so, the step a5 is executed, otherwise, the step a6 is executed;
in step a4, the keyboard filter driver determines whether the corrected current keyboard input information is interference information, which is the same as that determined by the keyboard filter driver in step S32, and is not repeated herein.
Step a 5: the keyboard filter driver updates the correction identification stored by the keyboard filter driver to a preset non-default identification, and removes the corrected current keyboard input information from the keyboard input data;
for example, the value of the preset non-default flag is 1.
Step a 6: the keyboard filter driver stores the corrected current keyboard input information to a corresponding position in the keyboard input data;
step a 7: the keyboard filter driver judges whether the current keyboard input information is interference information, if so, the step a8 is executed, otherwise, the current keyboard input information is stored to the position corresponding to the keyboard input data;
the keyboard filter driver determines whether the current keyboard input information is interference information in step a7, which is the same as the keyboard filter driver determines whether the current keyboard input information is interference information in step S32.
Step a 8: the keyboard filter driver judges whether the value of the first key identification in the current keyboard input information is equal to the value of the third key identification in the corresponding information record, if so, the current keyboard input information is removed from the keyboard input data; otherwise step a9 is performed.
Optionally, step a8 may also be: the keyboard filter driver judges whether the value of the first key identification in the current keyboard input information is equal to the key state value corresponding to the current keyboard input information, if so, the current keyboard input information is removed from the keyboard input data; otherwise step a9 is performed.
Specifically, the keyboard filter driver judges whether the value of the first key identifier is equal to the value of the first digit in the first key identifier, and if so, removes the current keyboard input information from the keyboard input data; otherwise step a9 is performed.
Optionally, step a8 may also be: the keyboard filter driver judges whether the value of the first key identification in the current keyboard input information is a first preset value or a second preset value stored by the keyboard filter driver, if so, the current keyboard input information is removed from the keyboard input data; otherwise step a9 is performed.
For example, the first preset value is 0, and the second preset value is 1.
Step a 9: and the keyboard filter driver updates the correction identifier stored by the keyboard filter driver to a preset non-default identifier, and removes the current keyboard input information from the keyboard input data.
Preferably, the preset non-default flag has a value of 1.
Optionally, in step a3, the correcting, by the keyboard filter driver, the first key identifier in the current keyboard input information according to the third preset value stored in the keyboard filter driver specifically includes: and the keyboard filter driver performs bit OR operation on the value of the first key identifier and a third preset value stored by the keyboard filter driver, and updates the first key identifier by using an operation result.
For example, the third preset value stored by the keyboard filter driver itself is 2, and the current keyboard input information obtained from the system keyboard driver is:
UnitId=0;
MakeCode=0x1e;
Flags=0;
namely, the value of the first key identification is 0, and the key state value corresponding to the keyboard input information is 0;
the keyboard filter driver performs bit or operation on a third preset value 2 and a value 0 of the first key identifier (binary number of 2 is 00000011, binary number of 0 is 00000000, and after bit or operation is performed on 00000010 and 00000000, 00000010 and 000000000000, 00000010 is obtained), the first key identifier is updated by using an operation result 2, and the corrected current keyboard input information is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=2;
that is, the value of the first key identifier in the corrected current keyboard input information is 2 (the corresponding binary number is 00000010).
Optionally, in step a3, the correcting, by the keyboard filter driver, the first key identifier in the current keyboard input information according to the third preset value stored in the keyboard filter driver specifically includes: and the keyboard filter driver performs addition operation on the value of the first key identifier and a third preset value stored by the keyboard filter driver, and updates the first key identifier by using an operation result.
For example, the third preset value is 2, and the current keyboard input information acquired by the keyboard filter driver is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=0;
namely, the value of the first key identification is 0, the keyboard filter driver performs addition operation on the value 0 of the first key identification and a third preset value 2 stored by the keyboard filter driver, the first key identification is updated by using the operation result 2, and the value of the updated first key identification is 2. The corrected keyboard input information is as follows:
UnitId=0;
MakeCode=0x1e;
Flags=2;
namely, the value of the first key identifier in the corrected current keyboard input information is 2.
Optionally, in step S31, after the keyboard filter driver obtains the keyboard input data from the system and before obtaining the current keyboard input information from the keyboard input data, the method further includes: the keyboard filter driver calculates the number of keyboard input information in the keyboard input data;
correspondingly, before the keyboard filter driver obtains the current keyboard input information from the keyboard input data, the method further comprises the following steps:
m1, the keyboard filter driver judges whether the cycle number is less than the number of the keyboard input information, if yes, the current keyboard input information is obtained from the keyboard input data, otherwise, the keyboard input data is returned to the system;
after the keyboard filter driver processes the current keyboard input information obtained from the keyboard input data each time, the method further comprises the following steps:
step m 2: the keyboard filter driver adds one to the cycle number and returns to the step m 1;
when the keyboard filter driver is initialized, the keyboard filter driver sets the cycle number as an initial value. For example, the initial value is 0.
In this embodiment, the keyboard filter driver executes step m2 after processing the current keyboard input information acquired from the keyboard input data each time, specifically: step m2 is executed after step S38, step m2 is executed after step S35, step m2 is executed after the keyboard filter driver removes the current keyboard input information from the keyboard input data, and step m2 is executed after the keyboard filter driver saves the current keyboard input information to the corresponding position in the keyboard input data.
Specifically, the keyboard filter driver calculates the number of keyboard input information in the keyboard input data, specifically: the keyboard filter driver uses a positive integer obtained by dividing the data length of the keyboard input data by the data length of the single keyboard input information in the keyboard input data.
In this embodiment, the keyboard filter driver sends the keyboard input data acquired from the system, specifically, the upper layer application to the system. Accordingly, after the keyboard filter driver returns the keyboard input data to the system, the system returns the data in the keyboard input information to the corresponding upper-layer application.
In this embodiment, when a key on the PS2 keyboard is pressed, the PS2 keyboard sends corresponding PS2 keyboard input data to the controller, and the system acquires the PS2 keyboard input data from the controller and processes the PS2 keyboard input data with reference to step a 1-step a4 and step B1-step B6 in embodiment 2, which is not described herein again.
In the present invention, the keyboard filter driver may occasionally send the simulated keyboard input information to the controller, and when the keyboard filter driver sends the simulated keyboard input data to the controller, before the keyboard filter driver takes out the corresponding keyboard input information from the system keyboard driver, the keyboard filter driver sends the simulated keyboard input data to the controller and the processing method of the system on the simulated keyboard input data refers to step D1 to step D9 in embodiment 2, which is not described herein again.
Compared with the prior art, the invention has the beneficial effects that: in the invention, when the PS2 keyboard input data comprises two bytes, after the PS2 keyboard sends a first byte to the controller, if the keyboard filter driver sends simulated keyboard input data to the controller, the keyboard filter driver updates the correction identifier stored by the keyboard filter driver to a preset non-default identifier after acquiring corresponding current keyboard input information, and when the keyboard filter driver acquires the keyboard input information corresponding to a second byte of the PS2 keyboard input data, judges that the correction identifier stored by the keyboard filter driver is not the default identifier, corrects the first key identifier in the current keyboard input information according to a third preset value stored by the keyboard filter driver, thereby effectively avoiding the second byte and the first byte of the PS2 keyboard input data from being split by the simulated keyboard input data, and ensuring the correctness of the PS2 keyboard input data received by an upper application; after the controller receives the PS2 keyboard input data, before the system keyboard driver takes away the PS2 keyboard input data in the controller, the keyboard filter driver will wait for the controller to be idle and then send the simulated keyboard input data to the controller, so that the simulated keyboard input data can be prevented from covering the PS2 keyboard input data in the controller, and the PS2 keyboard input data is ensured to be effective.
Example 4
The present embodiment provides a keyboard filter driver, and as shown in fig. 4, is a block diagram of module components of the keyboard filter driver, which specifically includes:
a first obtaining module 101, configured to obtain keyboard input data from a system;
a second obtaining module 102, configured to obtain current keyboard input information from the keyboard input data;
a storage module 103, configured to store the correction identifier;
the correcting module 104 is configured to correct the first key identifier in the current keyboard input information when the current keyboard input information acquired by the second acquiring module 102 is not interference information and the correction identifier stored by the storing module 103 is not a default identifier;
a first updating module 105, configured to update the correction identifier stored in the storage module 103 to a default identifier after the correction module 104 corrects the first key identifier in the current keyboard input information;
the storage module 106 is configured to store the current keyboard input information corrected by the correction module 104 to a corresponding position in the keyboard input data;
a first removing module 107, configured to remove the current keyboard input information from the keyboard input data when the current keyboard input information acquired by the second acquiring module 102 is interference information and the correction identifier stored by the storing module 103 is not a default identifier;
a second updating module 108, configured to update the correction identifier stored in the storage module 103 according to the first key identifier in the current keyboard input information when the current keyboard input information acquired by the second acquiring module 102 is interference information and the correction identifier stored in the storage module 103 is a default identifier;
the second removing module 109 is configured to remove the current keyboard input information from the keyboard input data after the second updating module 108 updates the correction identifier stored in the storage module 103 according to the first key identifier in the current keyboard input information;
a setting module 110, configured to set, when the keyboard filter driver is initialized, the correction identifier stored in the storage module 103 as a default identifier;
the returning module 111 is configured to return the keyboard input data to the system after the keyboard filter driver finishes processing all the keyboard input information in the keyboard input data acquired by the first acquiring module 101.
Optionally, the keyboard filter driver further comprises a first sending module, a second sending module and a third sending module,
the first sending module is used for sending a keyboard input forbidding instruction to the controller;
the second sending module is used for sending the simulated keyboard input data to the controller after the first sending module sends the keyboard input prohibition instruction to the controller, transmitting the simulated keyboard input data to the system through the controller, processing the simulated keyboard input data through the system to obtain keyboard input information, and storing the keyboard input information into the keyboard input data;
and the third sending module is used for sending a keyboard input permission instruction to the controller after the second sending module sends the simulated keyboard input data to the controller.
Optionally, the keyboard filter driver further includes a waiting module on the basis of including the first sending module, the second sending module and the third sending module,
and the waiting module is used for waiting for the controller to be idle before the first sending module sends the keyboard input forbidding instruction to the controller.
Optionally, the keyboard filter driver further includes a generating module on the basis of including the first sending module, the second sending module and the third sending module,
the generating module is used for generating an information record after the second sending module sends the input data of the simulation keyboard to the controller;
correspondingly, the saving module 103 is further configured to save the information record generated by the generating module;
when the current keyboard input information acquired by the second acquiring module 102 is interference information, the information record corresponding to the current keyboard input information is provided.
Optionally, the keyboard filter driver further includes a calculating module, a counting module and a first determining module;
the storage module 103 is further configured to store the cycle number;
the setting module 110 is further configured to set the cycle number stored by the storage module 103 as an initial value when the keyboard filter driver is initialized;
the calculation module is used for calculating the number of the keyboard input information in the keyboard input data acquired by the first acquisition module 101;
the first judging module is configured to judge whether the cycle number stored by the storing module 103 is smaller than the number of the keyboard input information calculated by the calculating module before the second obtaining module 102 obtains the current keyboard input information from the keyboard input information;
correspondingly, the returning module 111 is specifically configured to return the keyboard input data to the system when the first determining module determines that the number of cycles stored in the storing module 103 is not less than the number of the keyboard input information;
the second obtaining module 102 is specifically configured to obtain current keyboard input information from the keyboard input data when the first determining module determines that the cycle number stored by the storing module 103 is smaller than the number of the keyboard input information;
the counting module is used for adding one to the cycle times stored by the storage module 103 after the keyboard filter driver processes the current keyboard input information acquired from the keyboard input data each time;
the first judging module is further configured to, after the counting module adds one to the cycle times stored in the storing module 103, judge whether the cycle times stored in the storing module 103 is smaller than the number of the keyboard input information.
In this embodiment, the correction identifier stored in the storage module 103 in the keyboard filter driver is a second key identifier, and the default identifier is a default key identifier;
the correcting module 104 is specifically configured to correct the first key identifier in the current keyboard input information according to the second key identifier stored in the storing module 103 when the current keyboard input information acquired by the second acquiring module 102 is not interference information and the second key identifier stored in the storing module 103 is not a default key identifier;
the first updating module 105 is specifically configured to update the second key identifier stored in the storage module 103 to the default key identifier after the correcting module 104 corrects the first key identifier in the current keyboard input information according to the second key identifier stored in the storage module 103.
Specifically, the correction module 104 includes an operation sub-module and an update sub-module,
the operation sub-module is configured to add the value of the second key identifier stored in the storage module 103 to the value of the first key identifier when the current keyboard input information acquired by the second acquisition module 102 is not interference information and the second key identifier stored in the storage module 103 is not a default key identifier;
the updating submodule is used for updating the first key identification by using the operation result of the operation submodule;
correspondingly, the second updating module 108 is specifically configured to subtract the corresponding key state value from the value of the first key identifier in the current keyboard input information when the current keyboard input information acquired by the second acquiring module 102 is interference information and the second key identifier stored in the storing module 103 is a default key identifier, and update the second key identifier stored in the storing module 103 by using the operation result.
Specifically, the correction module 104 includes an operation sub-module and an update sub-module,
the operation sub-module is configured to perform bit or operation on the value of the second key identifier and the value of the first key identifier when the current keyboard input information acquired by the second acquisition module 102 is not interference information and the second key identifier stored by the storage module 103 is not a default key identifier;
the updating submodule is used for updating the first key identification by using the operation result of the operation submodule;
correspondingly, the second updating module 108 is specifically configured to, when the current keyboard input information acquired by the second acquiring module 102 is interference information, and the second key identifier stored in the storing module 103 is a default key identifier, negating the key state value corresponding to the current keyboard input information, performing bit and operation on the negating result and the value of the first key identifier in the current keyboard input information, and updating the second key identifier stored in the storing module 103 by using the operation result.
Specifically, the saving module 103 is further configured to save a first preset value and a second preset value; the information processing module is used for saving an information record corresponding to the current keyboard input information when the current keyboard input information acquired by the second acquisition module 102 is interference information;
correspondingly, the correcting module 104 is specifically configured to update the first key identifier in the current keyboard input information by using the second key identifier stored in the storing module 103 when the current keyboard input information acquired by the second acquiring module 102 is not interference information, the second key identifier stored in the storing module 103 is not a default key identifier, and the value of the first key identifier is the first preset value or the second preset value stored in the storing module 103;
the second updating module 108 is specifically configured to, when the current keyboard input information acquired by the second acquiring module 102 is interference information, the second key identifier stored in the storing module 103 is a default key identifier, and when a value of the first key identifier is not a first preset value or a second preset value stored in the storing module 103, or when the current keyboard input information acquired by the second acquiring module 102 is interference information, the second key identifier stored in the storing module 103 is a default key identifier, and when a value of the first key identifier is not equal to a value of a third key identifier in a corresponding information record; or when the current keyboard input information acquired by the second acquisition module is interference information, the second key identifier stored by the storage module is a default key identifier, and when the value of the first key identifier is not equal to the key state value corresponding to the current keyboard input information, the first key identifier is used to update the second key identifier stored by the storage module 103;
or, alternatively,
the correcting module 104 is specifically configured to update the first key identifier in the current keyboard input information by using the second key identifier stored in the storing module 103 when the current keyboard input information acquired by the second acquiring module 102 is not interference information, the second key identifier stored in the storing module 103 is not a default key identifier, and when the value of the first key identifier is equal to the key state value corresponding to the current keyboard input information;
correspondingly, the second updating module 108 is specifically configured to, when the current keyboard input information acquired by the second acquiring module 102 is interference information, the second key identifier stored by the storing module 103 is a default key identifier, and when a value of the first key identifier is not equal to a key state value corresponding to the current keyboard input information; or when the current keyboard input information acquired by the second acquiring module 102 is interference information, the second key identifier stored by the storing module 103 is a default key identifier, and when the value of the first key identifier is not equal to the value of the third key identifier in the corresponding information record; or when the current keyboard input information acquired by the second acquiring module is interference information, the second key identifier stored by the storing module is a default key identifier, and when the value of the first key identifier is not the first preset value or the second preset value stored by the storing module, the second key identifier stored by the storing module 103 is updated by using the first key identifier.
In this embodiment, the saving module 103 in the keyboard filter driver is further configured to save a third preset value, a first preset value, and a second preset value; the information processing module is used for saving an information record corresponding to the current keyboard input information when the current keyboard input information acquired by the second acquisition module 102 is interference information;
correspondingly, the correcting module 104 is specifically configured to correct the first key identifier in the current keyboard input information according to a third preset value stored by the storing module 103 when the current keyboard input information acquired by the second acquiring module 102 is not interference information and the correction identifier stored by the storing module 103 is not a default identifier, and when the value of the first key identifier is the first preset value or the second preset value stored by the storing module 103;
or, the correcting module 104 is specifically configured to correct the first key identifier in the current keyboard input information according to a third preset value stored by the storing module 103 when the current keyboard input information acquired by the second acquiring module 102 is not interference information, the correcting identifier stored by the storing module 103 is not a default identifier, and when the value of the first key identifier is equal to the key state value corresponding to the current keyboard input information;
the first updating module 105 is specifically configured to update the correction identifier stored by the storing module 103 to a default identifier after the correcting module 104 corrects the first key identifier in the current keyboard input information according to the third preset value stored by the storing module 103;
a second updating module 108, configured to update the correction identifier stored in the storing module 103 to a preset non-default identifier when the current keyboard input information acquired by the second acquiring module 102 is interference information, and the correction identifier stored in the storing module 103 is a default identifier, and when the value of the first key identifier is not equal to the value of the third key identifier in the information record stored in the storing module 103;
or, the second updating module 108 is specifically configured to update the correction identifier stored in the storing module 103 to a preset non-default identifier when the current keyboard input information acquired by the second acquiring module 102 is interference information, and the correction identifier stored in the storing module 103 is a default identifier, and when the value of the first key identifier is not equal to the key state value corresponding to the current keyboard input information;
or, the second updating module 108 is specifically configured to update the correction identifier stored in the storing module 103 to a preset non-default identifier when the current keyboard input information acquired by the second acquiring module 102 is interference information and the correction identifier stored in the storing module 103 is a default identifier, and when the value of the first key identifier is not the first preset value or the second preset value stored in the storing module 103.
Specifically, the correction module 104 includes an operation sub-module and an update sub-module,
the operation sub-module is configured to perform bit or operation on the value of the first key identifier and a third preset value stored in the storage module 103 when the current keyboard input information acquired by the second acquisition module 102 is not interference information and the correction identifier stored in the storage module 103 is not a default identifier, and when the value of the first key identifier is a first preset value or a second preset value;
or, the operation sub-module is configured to perform bit or operation on the value of the first key identifier and a third preset value stored by the storage module when the current keyboard input information acquired by the second acquisition module is not interference information, the correction identifier stored by the storage module is not a default identifier, and when the value of the first key identifier is equal to the key state value corresponding to the current keyboard input information;
and the updating submodule is used for updating the first key identification by using the operation result of the operation submodule.
Specifically, the correction module 104 includes an operation sub-module and an update sub-module,
the operation sub-module is configured to, when the current keyboard input information acquired by the second acquisition module 102 is not interference information, and the correction identifier stored in the storage module 103 is not a default identifier, and when the value of the first key identifier is a first preset value or a second preset value, perform an addition operation on the value of the first key identifier and a third preset value stored in the storage module 103;
or, the operation sub-module is configured to, when the current keyboard input information acquired by the second acquisition module is not interference information, the correction identifier stored by the storage module is not a default identifier, and when the value of the first key identifier is equal to the key state value corresponding to the current keyboard input information, perform an addition operation on the value of the first key identifier and a third preset value stored by the storage module;
and the updating submodule is used for updating the first key identification by using the operation result of the operation submodule.
In this embodiment, the keyboard filter driver further includes a second determining module, a third determining module, and a third updating module;
the second judging module is configured to judge whether the correction identifier stored by the storing module 103 is the default identifier after the second obtaining module 102 obtains the current keyboard input information from the keyboard input data;
correspondingly, the correcting module 104 is specifically configured to correct the first key identifier in the current keyboard input information when the second determining module determines that the correction identifier stored in the storing module 103 is not the default identifier;
the first updating module 105 is specifically configured to update the correction identifier stored by the storing module 103 to the default identifier after the second determining module determines that the correction identifier stored by the storing module 103 is not the default identifier and the correcting module 104 corrects the first key identifier in the current keyboard input information;
a third judging module, configured to judge whether the current keyboard input information corrected by the correcting module 104 is interference information;
a third updating module, configured to update the correction identifier stored in the storage module 103 according to the first key identifier in the current keyboard input information corrected by the correcting module 104 when the third determining module determines that the current keyboard input information corrected by the correcting module 104 is interference information;
the second removing module 109 is further configured to remove the current keyboard input information corrected by the correcting module 104 from the keyboard input data after the third updating module updates the correction identifier stored in the storing module 103 according to the first key identifier in the current keyboard input information corrected by the correcting module 104;
the storage module 106 is specifically configured to, when the third determining module determines that the current keyboard input information corrected by the correcting module 104 is not interference information, store the current keyboard input information corrected by the correcting module 104 in a corresponding position in the keyboard input data.
Optionally, the correction identifier stored in the storage module 103 is a second key identifier, and the default identifier is a default key identifier;
correspondingly, the correcting module 104 is specifically configured to correct the first key identifier in the current keyboard input information according to the second key identifier stored in the storing module 103 when the second judging module judges that the second key identifier stored in the storing module 103 is not the default key identifier;
the first updating module 105 is specifically configured to update the second key identifier stored in the storage module 103 to the default key identifier after the correcting module 104 corrects the first key identifier in the current keyboard input information according to the second key identifier stored in the storage module 103.
Specifically, the correction module 104 includes an operation submodule and an update submodule;
the operation sub-module is used for adding the value of the second key identifier stored by the storage module 103 with the value of the first key identifier when the second judgment module judges that the second key identifier stored by the storage module 103 is not the default key identifier;
the updating submodule is used for updating the first key identification by using the operation result of the operation submodule;
the third updating module is specifically configured to, when the third determining module determines that the current keyboard input information corrected by the correcting module 104 is interference information, subtract the corresponding key state value from the value of the first key identifier in the current keyboard input information corrected by the correcting module 104, and update the second key identifier stored by the storing module 103 by using the operation result;
the second updating module 108 is specifically configured to subtract the corresponding key state value from the value of the first key identifier in the current keyboard input information when the current keyboard input information acquired by the second acquiring module 102 is interference information and the second key identifier stored in the storing module 103 is a default key identifier, and update the second key identifier stored in the storing module 103 using the operation result.
Specifically, the correction module 104 includes an operation submodule and an update submodule;
the operation sub-module is used for performing bit or operation on the value of the second key identifier stored in the storage module 103 and the value of the first key identifier when the second judgment module judges that the second key identifier stored in the storage module 103 is not the default key identifier;
the updating submodule is used for updating the first key identification by using the operation result of the operation submodule;
correspondingly, the third updating module is specifically configured to, when the third determining module determines that the current keyboard input information corrected by the correcting module 104 is interference information, invert the key state value corresponding to the corrected current keyboard input information, perform bit and operation on the inverted result and the value of the first key identifier in the corrected current keyboard input information, and update the second key identifier stored in the storage module 103 by using the operation result;
the second updating module 108 is specifically configured to, when the current keyboard input information acquired by the second acquiring module 102 is interference information and the second key identifier stored in the storing module 103 is a default key identifier, negate the key state value corresponding to the current keyboard input information, perform bit and operation on the negated result and the value of the first key identifier in the current keyboard input information, and update the second key identifier stored in the storing module 103 using the operation result.
Specifically, the saving module 103 is further configured to save a first preset value and a second preset value; the information processing module is used for saving an information record corresponding to the current keyboard input information when the current keyboard input information acquired by the second acquisition module 102 is interference information;
correspondingly, the correcting module 104 is specifically configured to update the first key identifier in the current keyboard input information by using the second key identifier stored in the storing module 103 when the second determining module determines that the second key identifier stored in the storing module 103 is not the default key identifier and the value of the first key identifier is the first preset value or the second preset value;
or, the correcting module 104 is specifically configured to update the first key identifier in the current keyboard input information by using the second key identifier stored in the storing module 103 when the second determining module determines that the second key identifier stored in the storing module 103 is not the default key identifier, and when the value of the first key identifier is equal to the key state value corresponding to the current keyboard input information;
correspondingly, the third updating module is specifically configured to update the second key identifier stored in the storage module 103 by using the first key identifier corrected by the correcting module 104 when the third determining module determines that the current keyboard input information corrected by the correcting module 104 is interference information;
a second updating module 108, configured to, when the current keyboard input information acquired by the second acquiring module 102 is interference information, use the second key identifier stored in the storing module 103 as a default key identifier, and when the first key identifier is not a first preset value or a second preset value, update the second key identifier stored in the storing module 103 using the first key identifier;
or, the second updating module 108 is specifically configured to, when the current keyboard input information acquired by the second acquiring module 102 is interference information, use the second key identifier stored by the storing module 103 as a default key identifier, and when the value of the first key identifier is not equal to the key state value corresponding to the current keyboard input information, use the first key identifier to update the second key identifier stored by the storing module 103;
or, the second updating module 108 is specifically configured to, when the current keyboard input information acquired by the second acquiring module 102 is interference information, use the second key identifier stored by the storing module 103 as a default key identifier, and when the value of the first key identifier is not equal to the value of the third key identifier in the corresponding information record, use the first key identifier to update the second key identifier stored by the storing module 103.
Optionally, the saving module 103 is further configured to save a third preset value, a first preset value, and a second preset value; the information processing module is used for saving an information record corresponding to the current keyboard input information when the current keyboard input information acquired by the second acquisition module 102 is interference information;
correspondingly, the correcting module 104 is specifically configured to correct the first key identifier in the current keyboard input information according to a third preset value stored in the storing module 103 when the second determining module determines that the correction identifier stored in the storing module 103 is not the default identifier, and when the value of the first key identifier is the first preset value or the second preset value;
or, the correcting module 104 is specifically configured to correct the first key identifier in the current keyboard input information according to a third preset value stored by the storing module 103 when the second determining module determines that the correction identifier stored by the storing module 103 is not the default identifier, and when the value of the first key identifier is equal to the key state value corresponding to the current keyboard input information;
the first updating module 105 is specifically configured to update the correction identifier stored by the storing module 103 to a default identifier after the correcting module 104 corrects the first key identifier in the current keyboard input information according to the third preset value stored by the storing module 103;
a third updating module, configured to update the correction identifier to a preset non-default identifier when the third determining module determines that the current keyboard input information corrected by the correcting module 104 is interference information;
a second updating module 108, configured to specifically update the correction identifier stored in the storing module 103 to a preset non-default identifier when the current keyboard input information acquired by the second acquiring module 102 is interference information, and the second key identifier stored in the storing module 103 is a default key identifier, and when the value of the first key identifier is not equal to the value of the third key identifier in the corresponding information record;
or, the second updating module 108 is specifically configured to, when the current keyboard input information acquired by the second acquiring module 102 is interference information, the second key identifier stored by the storing module 103 is a default key identifier, and when the value of the first key identifier is not equal to the key state value corresponding to the current keyboard input information, update the correction identifier stored by the storing module 103 to a preset non-default identifier;
or, the second updating module 108 is specifically configured to, when the current keyboard input information acquired by the second acquiring module 102 is interference information, the second key identifier stored by the storing module 103 is a default key identifier, and when the first key identifier is not the first preset value or the second preset value, update the correction identifier stored by the storing module 103 to a preset non-default identifier.
Specifically, the correction module 104 includes an operation submodule and an update submodule;
the operation sub-module is used for performing bit or operation on the value of the first key identifier and a third preset value stored by the storage module 103 when the second judgment module judges that the correction identifier stored by the storage module 103 is not the default identifier and the value of the first key identifier is the first preset value or the second preset value;
or, the operation sub-module is used for performing bit or operation on the value of the first key identifier and a third preset value stored by the storage module when the second judgment module judges that the correction identifier stored by the storage module is not the default identifier and when the value of the first key identifier is equal to the key state value corresponding to the current keyboard input information;
and the updating submodule is used for updating the first key identification by using the operation result of the operation submodule.
Specifically, the correction module 104 includes an operation submodule and an update submodule;
the operation sub-module is used for performing addition operation on the value of the first key identifier and a third preset value stored by the storage module 103 when the second judgment module judges that the correction identifier stored by the storage module 103 is not the default identifier and the value of the first key identifier is the first preset value or the second preset value;
or, the operation sub-module is configured to, when the second determination module determines that the correction identifier stored by the storage module is not the default identifier, and when the value of the first key identifier is equal to the key state value corresponding to the current keyboard input information, perform addition operation on the value of the first key identifier and a third preset value stored by the storage module;
and the updating submodule is used for updating the first key by using the operation result of the operation submodule.
Optionally, the storage module 106 in the keyboard filter driver is further configured to store the current keyboard input information acquired by the second acquiring module 102 to a corresponding position in the keyboard input data when the current keyboard input information acquired by the second acquiring module 102 is not interference information and the correction identifier stored by the storing module 103 is a default identifier.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and the changes or substitutions should be covered within the scope of the present invention.

Claims (42)

1. A method for improving keyboard input correctness is characterized by comprising the following steps:
step S1: the keyboard filter driver acquires keyboard input data from the system;
step S2: the keyboard filter driver acquires current keyboard input information from the keyboard input data;
when the current keyboard input information is not interference information and the correction identifier stored by the keyboard filter driver is not a default identifier, executing step S3;
when the current keyboard input information is interference information and the correction identifier stored by the keyboard filter driver is not a default identifier, executing step S4;
when the current keyboard input information is interference information and the correction identifier stored by the keyboard filter driver is a default identifier, executing step S5;
when the keyboard filter driver is initialized, the keyboard filter driver sets the correction identifier as a default identifier;
step S3: the keyboard filter driver corrects a first key identification in current keyboard input information, updates the correction identification into a default identification, and stores the corrected current keyboard input information into a corresponding position in keyboard input data;
step S4: the keyboard filter driver removes the current keyboard input information from the keyboard input data;
step S5: the keyboard filter driver updates the correction identifier stored by the keyboard filter driver according to the first key identifier in the current keyboard input information, and removes the current keyboard input information from the keyboard input data;
and after the keyboard filter driver processes all the keyboard input information in the keyboard input data, returning the keyboard input data to the system.
2. The method of claim 1, wherein step s1 is preceded by:
step N1: the keyboard filter driver sends a keyboard input prohibition instruction to the controller;
step N2: the keyboard filter driver sends simulated keyboard input data to the controller, the simulated keyboard input data are transmitted to a system through the controller, the simulated keyboard input data are processed through the system to obtain keyboard input information, and the keyboard input information is stored in the keyboard input data;
in step N2, after the keyboard filter driver sends the simulated keyboard input data to the controller, the method further includes: the keypad filter driver sends keypad enabled input instructions to the controller.
3. The method according to claim 2, further comprising, before the step N1: the keyboard filter driver waits for the controller to idle.
4. The method according to claim 2, wherein after said keyboard filter driver sends simulated keyboard input data to said controller in step N2, further comprising: the keyboard filter driver generates and stores information records;
and when the current keyboard input information acquired by the keyboard filter driver is interference information, the information record corresponding to the current keyboard input information is provided.
5. The method according to claim 1, wherein in the step S1, the method further comprises: the keyboard filter driver calculates the number of keyboard input information in the keyboard input data;
before the step S2, the method further includes:
m1, the keyboard filter driver judges whether the circulation times is less than the number of the keyboard input information, if yes, the step S2 is executed, otherwise, the keyboard input data is returned to the system;
after the keyboard filter driver processes the current keyboard input information obtained from the keyboard input data each time, the method further comprises the following steps:
step m 2: the keyboard filter driver adds one to the cycle number and returns to the step m 1;
and when the keyboard filter driver is initialized, the keyboard filter driver sets the cycle times as initial values.
6. The method of claim 1, wherein the corrective identifier is a second key identifier saved by the keyboard filter driver itself, and the default identifier is a default key identifier;
the keyboard filter driver corrects a first key identification in current keyboard input information, and updates the correction identification into a default identification, specifically: and the keyboard filter driver corrects the first key identification in the current keyboard input information according to the second key identification stored by the keyboard filter driver, and updates the second key identification into the default key identification.
7. The method according to claim 6, wherein the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored therein, specifically: the keyboard filter driver adds the value of the second key identifier and the value of the first key identifier, and updates the first key identifier by using the operation result;
the keyboard filter driver updates the correction identifier stored by the keyboard filter driver according to the first key identifier in the current keyboard input information, and specifically comprises the following steps: and the keyboard filter driver subtracts the key state value corresponding to the current keyboard input information from the value of the first key identifier in the current keyboard input information, and updates the second key identifier by using the operation result.
8. The method according to claim 6, wherein the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored therein, specifically: the keyboard filter driver performs bit OR operation on the value of the second key identifier and the value of the first key identifier, and updates the first key identifier by using an operation result;
the keyboard filter driver updates the correction identifier stored by the keyboard filter driver according to the first key identifier in the current keyboard input information, and specifically comprises the following steps: and the keyboard filter driver inverts the key state value corresponding to the current keyboard input information, performs bit AND operation on the inverted result and the value of the first key identifier in the current keyboard input information, and updates the second key identifier by using the operation result.
9. The method of claim 6,
the keyboard filter driver corrects a first key identifier in current keyboard input information according to a second key identifier stored by the keyboard filter driver, and specifically comprises the following steps: when the value of the first key identification is a first preset value or a second preset value stored by the keyboard filter driver, the keyboard filter driver updates the first key identification in the current keyboard input information by using the second key identification stored by the keyboard filter driver;
the keyboard filter driver updates the correction identifier stored by the keyboard filter driver according to the first key identifier in the current keyboard input information, and specifically comprises the following steps: when the value of the first key identification is not the first preset value or the second preset value stored by the keyboard filter driver, or when the value of the first key identification is not equal to the value of the third key identification in the corresponding information record, or when the value of the first key identification is not equal to the key state value corresponding to the current keyboard input information, the keyboard filter driver updates the second key identification stored by the keyboard filter driver by using the first key identification;
or, the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored by the keyboard filter driver, specifically: when the value of the first key identification is equal to the key state value corresponding to the current keyboard input information, the keyboard filter driver updates the first key identification in the current keyboard input information by using a second key identification stored by the keyboard filter driver;
the keyboard filter driver updates the correction identifier stored by the keyboard filter driver according to the first key identifier in the current keyboard input information, and specifically comprises the following steps: and when the value of the first key identification is not equal to the key state value corresponding to the current keyboard input information, or when the value of the first key identification is not equal to the value of the third key identification in the corresponding information record, or when the value of the first key identification is not the first preset value or the second preset value stored by the keyboard filter driver, the keyboard filter driver updates the second key identification stored by the keyboard filter driver by using the first key identification.
10. The method of claim 1,
the keyboard filter driver corrects a first key identification in current keyboard input information, and updates the correction identification into a default identification, specifically: when the value of the first key identification is a first preset value or a second preset value stored by the keyboard filter driver, or when the value of the first key identification is equal to a key state value corresponding to current keyboard input information, the keyboard filter driver corrects the first key identification in the current keyboard input information according to a third preset value stored by the keyboard filter driver, and updates the correction identification to a default identification;
the keyboard filter driver updates the correction identifier stored by the keyboard filter driver according to the first key identifier in the current keyboard input information, and specifically comprises the following steps: and when the value of the first key identification is not equal to the value of the third key identification in the corresponding information record, or when the value of the first key identification is not equal to the key state value corresponding to the current keyboard input information, or when the value of the first key identification is not the first preset value or the second preset value stored by the keyboard filter driver, the keyboard filter driver updates the correction identification stored by the keyboard filter driver to the preset non-default identification.
11. The method according to claim 10, wherein the keyboard filter driver corrects the first key identifier in the current keyboard input information according to a third preset value stored therein, specifically: and the keyboard filter driver performs bit OR operation on the value of the first key identifier and a third preset value stored by the keyboard filter driver, and updates the first key identifier by using an operation result.
12. The method according to claim 10, wherein the keyboard filter driver corrects the first key identifier in the current keyboard input information according to a third preset value stored therein, specifically: and the keyboard filter driver performs addition operation on the value of the first key identifier and a third preset value stored by the keyboard filter driver, and updates the first key identifier by using an operation result.
13. The method according to claim 1, wherein the step S3 specifically includes:
step a1: the keyboard filter driver judges whether the correction identification stored by the keyboard filter driver is a default identification;
when the keyboard filter driver judges that the correction identifier stored by the keyboard filter driver is not the default identifier, executing a step a 2;
step a 2: the keyboard filter driver corrects a first key identification in current keyboard input information, and updates the correction identification into a default identification;
step a 3: the keyboard filter driver judges whether the corrected current keyboard input information is interference information;
when the keyboard filter driver judges that the corrected current keyboard input information is not interference information, executing a step a 4;
step a 4: and the keyboard filter driver stores the corrected current keyboard input information to a corresponding position in the keyboard input data.
14. The method of claim 13, wherein the corrective identifier is a second key identifier saved by the keyboard filter driver itself, and the default identifier is a default key identifier;
the keyboard filter driver corrects a first key identification in current keyboard input information, and updates the correction identification into a default identification, specifically: and the keyboard filter driver corrects the first key identification in the current keyboard input information according to the second key identification stored by the keyboard filter driver, and updates the second key identification into the default key identification.
15. The method according to claim 14, wherein the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored therein, specifically: the keyboard filter driver adds the value of the second key identifier and the value of the first key identifier, and updates the first key identifier by using the operation result;
the keyboard filter driver updates the correction identifier stored by the keyboard filter driver according to the first key identifier in the current keyboard input information, and specifically comprises the following steps: and the keyboard filter driver subtracts the corresponding key state value from the value of the first key identifier in the current keyboard input information, and updates the second key identifier stored by the keyboard filter driver by using the operation result.
16. The method according to claim 14, wherein the keyboard filter driver corrects the first key identifier in the current keyboard input information according to the second key identifier stored therein, specifically: the keyboard filter driver performs bit OR operation on the value of the second key identifier and the value of the first key identifier, and updates the first key identifier by using an operation result;
the keyboard filter driver updates the correction identifier stored by the keyboard filter driver according to the first key identifier in the current keyboard input information, and specifically comprises the following steps: and the keyboard filter driver inverts the key state value corresponding to the current keyboard input information, performs bit and operation on the inverted result and the value of the first key identifier in the current keyboard input information, and updates the second key identifier stored by the keyboard filter driver by using the operation result.
17. The method of claim 14,
the keyboard filter driver corrects a first key identifier in current keyboard input information according to a second key identifier stored by the keyboard filter driver, and specifically comprises the following steps: when the value of the first key identification is a first preset value or a second preset value stored by the keyboard filter driver, or when the value of the first key identification is equal to the key state value corresponding to the current keyboard input information, the keyboard filter driver updates the first key identification in the current keyboard input information by using the second key identification stored by the keyboard filter driver;
the keyboard filter driver updates the correction identifier stored by the keyboard filter driver according to the first key identifier in the current keyboard input information, and specifically comprises the following steps: and when the first key identification is not the first preset value or the second preset value stored by the keyboard filter driver, or when the value of the first key identification is not equal to the key state value corresponding to the current keyboard input information, or when the value of the first key identification is not equal to the value of the third key identification in the corresponding information record, the keyboard filter driver updates the second key identification stored by the keyboard filter driver by using the first key identification.
18. The method of claim 13,
the keyboard filter driver corrects a first key identification in current keyboard input information, and updates the correction identification into a default identification, specifically: when the value of the first key identification is a first preset value or a second preset value stored by the keyboard filter driver, or when the value of the first key identification is equal to a key state value corresponding to current keyboard input information, the keyboard filter driver corrects the first key identification in the current keyboard input information according to a third preset value stored by the keyboard filter driver, and updates the correction identification to a default identification;
the keyboard filter driver updates the correction identifier stored by the keyboard filter driver according to the first key identifier in the corrected current keyboard input information, and specifically comprises the following steps: the keyboard filter driver updates the correction identification stored by the keyboard filter driver to a preset non-default identification;
the keyboard filter driver updates the correction identifier stored by the keyboard filter driver according to the first key identifier in the current keyboard input information, and specifically comprises the following steps: and when the value of the first key identification is not equal to the value of the third key identification in the corresponding information record, or when the value of the first key identification is not equal to the key state value corresponding to the current keyboard input information, or when the first key identification is not the first preset value or the second preset value stored by the keyboard filter driver, the keyboard filter driver updates the correction identification stored by the keyboard filter driver to be the preset non-default identification.
19. The method according to claim 18, wherein the keyboard filter driver corrects the first key identifier in the current keyboard input information according to a third preset value stored therein, specifically: and the keyboard filter driver performs bit OR operation on the value of the first key identifier and a third preset value stored by the keyboard filter driver, and updates the first key identifier by using an operation result.
20. The method according to claim 18, wherein the keyboard filter driver corrects the first key identifier in the current keyboard input information according to a third preset value stored therein, specifically: and the keyboard filter driver performs addition operation on the value of the first key identifier and a third preset value stored by the keyboard filter driver, and updates the first key identifier by using an operation result.
21. The method according to claim 1, wherein after the step S2, the method further comprises:
when the current keyboard input information is not interference information and the correction identifier stored by the keyboard filter driver is a default identifier, executing step S6;
step S6: and the keyboard filter driver stores the current keyboard input information to the corresponding position in the keyboard input data.
22. A keyboard filter driver, comprising:
the first acquisition module is used for acquiring keyboard input data from the system;
the second acquisition module is used for acquiring current keyboard input information from the keyboard input data;
the storage module is used for storing the correction identifier;
the correction module is used for correcting the first key identification in the current keyboard input information when the current keyboard input information acquired by the second acquisition module is not interference information and the correction identification stored by the storage module is not a default identification;
the first updating module is used for updating the correction identifier stored by the storage module into a default identifier after the correction module corrects the first key identifier in the current keyboard input information;
the storage module is used for storing the current keyboard input information corrected by the correction module to a corresponding position in the keyboard input data;
the first removing module is used for removing the current keyboard input information from the keyboard input data when the current keyboard input information acquired by the second acquiring module is interference information and the correction identifier stored by the storing module is not a default identifier;
the second updating module is used for updating the correction identifier stored by the storage module according to the first key identifier in the current keyboard input information when the current keyboard input information acquired by the second acquiring module is interference information and the correction identifier stored by the storage module is a default identifier;
the second removing module is used for removing the current keyboard input information from the keyboard input data after the second updating module updates the correction identifier stored by the storage module according to the first key identifier in the current keyboard input information;
the setting module is used for setting the correction identifier stored by the storage module as a default identifier when the keyboard filter driver is initialized;
and the returning module is used for returning the keyboard input data to the system after the keyboard filter driver finishes processing all the keyboard input information in the keyboard input data acquired by the first acquiring module.
23. The keyboard filter driver of claim 22, further comprising a first transmit module, a second transmit module, and a third transmit module,
the first sending module is used for sending a keyboard input forbidding instruction to the controller;
the second sending module is used for sending simulated keyboard input data to the controller after the first sending module sends a keyboard input prohibition instruction to the controller, transmitting the simulated keyboard input data to a system through the controller, processing the simulated keyboard input data through the system to obtain keyboard input information, and storing the keyboard input information into the keyboard input data;
and the third sending module is used for sending a keyboard input permission instruction to the controller after the second sending module sends the simulated keyboard input data to the controller.
24. The keyboard filter driver of claim 23, further comprising a wait module,
the waiting module is used for waiting the controller to be idle before the first sending module sends a keyboard input forbidding instruction to the controller.
25. The keyboard filter driver of claim 23, further comprising a generation module,
the generating module is used for generating an information record after the second sending module sends the simulated keyboard input data to the controller;
the storage module is further configured to store the information record generated by the generation module;
and when the current keyboard input information acquired by the second acquisition module is interference information, the information record corresponding to the current keyboard input information is provided.
26. The keyboard filter driver of claim 22, further comprising a calculating module, a counting module and a first determining module;
the storage module is also used for storing the cycle times;
the setting module is further configured to set the cycle number stored by the storage module as an initial value when the keyboard filter driver is initialized;
the calculation module is used for calculating the number of the keyboard input information in the keyboard input data acquired by the first acquisition module;
the first judging module is used for judging whether the cycle times stored by the storing module are smaller than the number of the keyboard input information calculated by the calculating module before the second acquiring module acquires the current keyboard input information from the keyboard input information;
the return module is specifically configured to return the keyboard input data to the system when the first judgment module judges that the cycle number stored by the storage module is not less than the number of the keyboard input information;
the second obtaining module is specifically configured to obtain current keyboard input information from the keyboard input data when the first determining module determines that the cycle number stored by the storing module is smaller than the number of the keyboard input information;
the counting module is used for adding one to the cycle times stored by the storage module after the keyboard filter driver processes the current keyboard input information acquired from the keyboard input data each time;
the first judging module is further configured to judge whether the cycle number stored by the storing module is smaller than the number of the keyboard input information after the counting module adds one to the cycle number stored by the storing module.
27. The keypad filter driver of claim 22,
the correction identifier stored by the storage module is a second key identifier, and the default identifier is a default key identifier;
the correcting module is specifically configured to correct a first key identifier in the current keyboard input information according to a second key identifier stored by the storing module when the current keyboard input information acquired by the second acquiring module is not interference information and the second key identifier stored by the storing module is not a default key identifier;
the first updating module is specifically configured to update the second key identifier stored by the storage module to the default key identifier after the correction module corrects the first key identifier in the current keyboard input information according to the second key identifier stored by the storage module.
28. The keyboard filter driver of claim 27, wherein the remediation module comprises an arithmetic sub-module and an update sub-module,
the operation sub-module is configured to add the value of the second key identifier stored in the storage module to the value of the first key identifier when the current keyboard input information acquired by the second acquisition module is not interference information and the second key identifier stored in the storage module is not a default key identifier;
the updating submodule is used for updating the first key identification by using the operation result of the operation submodule;
the second updating module is specifically configured to subtract the corresponding key state value from the value of the first key identifier in the current keyboard input information when the current keyboard input information acquired by the second acquiring module is interference information and the second key identifier stored by the storing module is a default key identifier, and update the second key identifier stored by the storing module using the operation result.
29. The keyboard filter driver of claim 27, wherein the remediation module comprises an arithmetic sub-module and an update sub-module,
the operation sub-module is used for performing bit or operation on the value of the second key identification and the value of the first key identification when the current keyboard input information acquired by the second acquisition module is not interference information and the second key identification stored by the storage module is not a default key identification;
the updating submodule is used for updating the first key identification by using the operation result of the operation submodule;
the second updating module is specifically configured to, when the current keyboard input information acquired by the second acquiring module is interference information and the second key identifier stored in the storing module is a default key identifier, negate a key state value corresponding to the current keyboard input information, perform bit and operation on an negated result and a value of the first key identifier in the current keyboard input information, and update the second key identifier stored in the storing module using an operation result.
30. The keyboard filter driver of claim 27,
the storage module is also used for storing a first preset value and a second preset value; the information acquisition module is used for acquiring current keyboard input information from the first acquisition module;
the correction module is specifically configured to update the first key identifier in the current keyboard input information by using the second key identifier stored by the storage module when the current keyboard input information acquired by the second acquisition module is not interference information and the second key identifier stored by the storage module is not a default key identifier, and when the value of the first key identifier is a first preset value or a second preset value stored by the storage module;
the second updating module is specifically configured to, when the current keyboard input information acquired by the second acquiring module is interference information, the second key identifier stored by the storing module is a default key identifier, and when the value of the first key identifier is not the first preset value or the second preset value stored by the storing module; or when the current keyboard input information acquired by the second acquisition module is interference information, the second key identification stored by the storage module is a default key identification, and when the value of the first key identification is not equal to the value of the third key identification in the corresponding information record; or when the current keyboard input information acquired by the second acquisition module is interference information, the second key identification stored by the storage module is a default key identification, and when the value of the first key identification is not equal to the key state value corresponding to the current keyboard input information, the first key identification is used for updating the second key identification stored by the storage module;
or,
the correction module is specifically configured to update the first key identifier in the current keyboard input information by using the second key identifier stored in the storage module when the current keyboard input information acquired by the second acquisition module is not interference information, the second key identifier stored in the storage module is not a default key identifier, and when the value of the first key identifier is equal to the key state value corresponding to the current keyboard input information;
the second updating module is specifically configured to, when the current keyboard input information acquired by the second acquiring module is interference information, the second key identifier stored by the storing module is a default key identifier, and when a value of the first key identifier is not equal to a key state value corresponding to the current keyboard input information; or when the current keyboard input information acquired by the second acquisition module is interference information, the second key identification stored by the storage module is a default key identification, and when the value of the first key identification is not equal to the value of the third key identification in the corresponding information record; or when the current keyboard input information acquired by the second acquisition module is interference information, the second key identification stored by the storage module is a default key identification, and when the value of the first key identification is not the first preset value or the second preset value stored by the storage module, the second key identification stored by the storage module is updated by using the first key identification.
31. The keypad filter driver of claim 22,
the storage module is also used for storing a third preset value, a first preset value and a second preset value; the information acquisition module is used for acquiring current keyboard input information from the first acquisition module;
the correcting module is specifically configured to correct the first key identifier in the current keyboard input information according to the third preset value stored by the storing module when the current keyboard input information acquired by the second acquiring module is not interference information and the correction identifier stored by the storing module is not a default identifier, and when the value of the first key identifier is the first preset value or the second preset value stored by the storing module;
or, the correcting module is specifically configured to correct the first key identifier in the current keyboard input information according to the third preset value stored by the storing module when the current keyboard input information acquired by the second acquiring module is not interference information and the correcting identifier stored by the storing module is not a default identifier, and when the value of the first key identifier is equal to the key state value corresponding to the current keyboard input information;
the first updating module is specifically configured to update the correction identifier stored by the storage module to a default identifier after the correction module corrects the first key identifier in the current keyboard input information according to the third preset value stored by the storage module;
the second updating module is specifically configured to update the correction identifier stored by the storing module to a preset non-default identifier when the current keyboard input information acquired by the second acquiring module is interference information and the correction identifier stored by the storing module is a default identifier, and when the value of the first key identifier is not equal to the value of the third key identifier in the information record stored by the storing module;
or, the second updating module is specifically configured to update the correction identifier stored by the storage module to a preset non-default identifier when the current keyboard input information acquired by the second acquiring module is interference information and the correction identifier stored by the storage module is a default identifier, and when the value of the first key identifier is not equal to the key state value corresponding to the current keyboard input information;
or, the second updating module is specifically configured to update the correction identifier stored by the storage module to a preset non-default identifier when the current keyboard input information acquired by the second acquiring module is interference information and the correction identifier stored by the storage module is a default identifier, and when the value of the first key identifier is not the first preset value or the second preset value stored by the storage module.
32. The keyboard filter driver of claim 31, wherein the remediation module comprises an arithmetic sub-module and an update sub-module,
the operation sub-module is configured to perform bit or operation on the value of the first key identifier and a third preset value stored by the storage module when the current keyboard input information acquired by the second acquisition module is not interference information and the correction identifier stored by the storage module is not a default identifier, and when the value of the first key identifier is a first preset value or a second preset value;
or, the operation sub-module is configured to perform bit or operation on the value of the first key identifier and a third preset value stored by the storage module when the current keyboard input information acquired by the second acquisition module is not interference information and the correction identifier stored by the storage module is not a default identifier, and when the value of the first key identifier is equal to the key state value corresponding to the current keyboard input information;
and the updating submodule is used for updating the first key identification by using the operation result of the operation submodule.
33. The keyboard filter driver of claim 31, wherein the remediation module comprises an arithmetic sub-module and an update sub-module,
the operation sub-module is configured to, when the current keyboard input information acquired by the second acquisition module is not interference information, and the correction identifier stored by the storage module is not a default identifier, and when the value of the first key identifier is a first preset value or a second preset value, perform an addition operation on the value of the first key identifier and a third preset value stored by the storage module;
or, the operation sub-module is configured to, when the current keyboard input information acquired by the second acquisition module is not interference information, the correction identifier stored by the storage module is not a default identifier, and when a value of the first key identifier is equal to a key state value corresponding to the current keyboard input information, perform an addition operation on the value of the first key identifier and a third preset value stored by the storage module;
and the updating submodule is used for updating the first key identification by using the operation result of the operation submodule.
34. The keyboard filter driver of claim 22, further comprising a second judgment module and a third judgment module;
the second judging module is configured to judge whether the correction identifier stored by the storing module is a default identifier after the second obtaining module obtains current keyboard input information from the keyboard input data;
the correction module is specifically configured to correct a first key identifier in current keyboard input information when the second determination module determines that the correction identifier stored by the storage module is not the default identifier;
the first updating module is specifically configured to update the correction identifier stored by the storage module to the default identifier after the second determining module determines that the correction identifier stored by the storage module is not the default identifier and the correction module corrects the first key identifier in the current keyboard input information;
the third judging module is used for judging whether the current keyboard input information corrected by the correcting module is interference information;
the storage module is specifically configured to store the current keyboard input information corrected by the correction module to a corresponding position in the keyboard input data when the third determination module determines that the current keyboard input information corrected by the correction module is not interference information.
35. The keyboard filter driver of claim 34,
the correction identifier stored by the storage module is a second key identifier, and the default identifier is a default key identifier;
the correcting module is specifically configured to correct a first key identifier in current keyboard input information according to a second key identifier stored by the storage module when the second judging module judges that the second key identifier stored by the storage module is not the default key identifier;
the first updating module is specifically configured to update the second key identifier stored by the storage module to the default key identifier after the correction module corrects the first key identifier in the current keyboard input information according to the second key identifier stored by the storage module.
36. The keyboard filter driver of claim 35, wherein the remediation module comprises an arithmetic sub-module and an update sub-module;
the operation sub-module is configured to add the value of the second key identifier stored in the storage module to the value of the first key identifier when the second judgment module judges that the second key identifier stored in the storage module is not the default key identifier;
the updating submodule is used for updating the first key identification by using the operation result of the operation submodule;
the second updating module is specifically configured to subtract the corresponding key state value from the value of the first key identifier in the current keyboard input information when the current keyboard input information acquired by the second acquiring module is interference information and the second key identifier stored by the storing module is a default key identifier, and update the second key identifier stored by the storing module using the operation result.
37. The keyboard filter driver of claim 35, wherein the remediation module comprises an arithmetic sub-module and an update sub-module;
the operation sub-module is configured to perform bit or operation on the value of the second key identifier stored by the storage module and the value of the first key identifier when the second judgment module judges that the second key identifier stored by the storage module is not the default key identifier;
the updating submodule is used for updating the first key identification by using the operation result of the operation submodule;
the second updating module is specifically configured to, when the current keyboard input information acquired by the second acquiring module is interference information and the second key identifier stored in the storing module is a default key identifier, negate a key state value corresponding to the current keyboard input information, perform bit and operation on an negated result and a value of the first key identifier in the current keyboard input information, and update the second key identifier stored in the storing module using an operation result.
38. The keyboard filter driver of claim 35,
the storage module is also used for storing a first preset value and a second preset value; the information acquisition module is used for acquiring current keyboard input information from the first acquisition module;
the correction module is specifically configured to update the first key identifier in the current keyboard input information by using the second key identifier stored by the storage module when the second judgment module judges that the second key identifier stored by the storage module is not the default key identifier and the value of the first key identifier is the first preset value or the second preset value;
or, the correcting module is specifically configured to update the first key identifier in the current keyboard input information by using the second key identifier stored in the storage module when the second determining module determines that the second key identifier stored in the storage module is not the default key identifier, and when the value of the first key identifier is equal to the key state value corresponding to the current keyboard input information;
the second updating module is specifically configured to, when the current keyboard input information acquired by the second acquiring module is interference information, use the second key identifier stored by the storing module as a default key identifier, and when the first key identifier is not a first preset value or a second preset value, update the second key identifier stored by the storing module using the first key identifier;
or, the second updating module is specifically configured to update the second key identifier stored by the storing module by using the first key identifier when the current keyboard input information acquired by the second acquiring module is interference information, the second key identifier stored by the storing module is a default key identifier, and the value of the first key identifier is not equal to the key state value corresponding to the current keyboard input information;
or, the second updating module is specifically configured to update the second key identifier stored by the storing module by using the first key identifier when the current keyboard input information acquired by the second acquiring module is interference information, the second key identifier stored by the storing module is a default key identifier, and when the value of the first key identifier is not equal to the value of the third key identifier in the corresponding information record.
39. The keyboard filter driver of claim 34,
the storage module is also used for storing a third preset value, a first preset value and a second preset value; the information acquisition module is used for acquiring current keyboard input information from the first acquisition module;
the correcting module is specifically configured to correct the first key identifier in the current keyboard input information according to a third preset value stored by the storage module when the second determining module determines that the correction identifier stored by the storage module is not the default identifier and when the value of the first key identifier is the first preset value or the second preset value;
or, the correcting module is specifically configured to correct the first key identifier in the current keyboard input information according to a third preset value stored by the storage module when the second determining module determines that the correction identifier stored by the storage module is not the default identifier and when the value of the first key identifier is equal to the key state value corresponding to the current keyboard input information;
the first updating module is specifically configured to update the correction identifier stored by the storage module to a default identifier after the correction module corrects the first key identifier in the current keyboard input information according to the third preset value stored by the storage module;
the second updating module is specifically configured to update the correction identifier stored by the storing module to a preset non-default identifier when the current keyboard input information acquired by the second acquiring module is interference information, the second key identifier stored by the storing module is a default key identifier, and when the value of the first key identifier is not equal to the value of the third key identifier in the corresponding information record;
or, the second updating module is specifically configured to update the correction identifier stored in the storage module to a preset non-default identifier when the current keyboard input information acquired by the second acquiring module is interference information, the second key identifier stored in the storage module is a default key identifier, and when the value of the first key identifier is not equal to the key state value corresponding to the current keyboard input information;
or, the second updating module is specifically configured to, when the current keyboard input information acquired by the second acquiring module is interference information, the second key identifier stored by the storing module is a default key identifier, and when the first key identifier is not a first preset value or a second preset value, update the correction identifier stored by the storing module to a preset non-default identifier.
40. The keyboard filter driver of claim 39, wherein the remediation module comprises an arithmetic sub-module and an update sub-module;
the operation sub-module is configured to perform bit or operation on the value of the first key identifier and a third preset value stored by the storage module when the second determination module determines that the correction identifier stored by the storage module is not the default identifier and when the value of the first key identifier is the first preset value or the second preset value;
or, the operation sub-module is configured to perform bit or operation on the value of the first key identifier and a third preset value stored by the storage module when the second determination module determines that the correction identifier stored by the storage module is not the default identifier, and when the value of the first key identifier is equal to the key state value corresponding to the current keyboard input information;
and the updating submodule is used for updating the first key identification by using the operation result of the operation submodule.
41. The keyboard filter driver of claim 39, wherein the remediation module comprises an arithmetic sub-module and an update sub-module;
the operation sub-module is configured to, when the second determination module determines that the correction identifier stored in the storage module is not the default identifier, and when the value of the first key identifier is the first preset value or the second preset value, perform an addition operation on the value of the first key identifier and a third preset value stored in the storage module;
or, the operation sub-module is configured to, when the second determination module determines that the correction identifier stored by the storage module is not the default identifier, and when the value of the first key identifier is equal to the key state value corresponding to the current keyboard input information, perform addition operation on the value of the first key identifier and a third preset value stored by the storage module;
and the updating submodule is used for updating the first key by using the operation result of the operation submodule.
42. The keyboard filter driver of claim 22, wherein the storage module is further configured to store the current keyboard input information acquired by the second acquisition module into a corresponding location in the keyboard input data when the current keyboard input information acquired by the second acquisition module is not interference information and the correction identifier stored by the storage module is a default identifier.
CN201610681143.2A 2016-08-17 2016-08-17 A kind of method and keyboard filter driving improving keyboard input correctness Active CN106293132B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610681143.2A CN106293132B (en) 2016-08-17 2016-08-17 A kind of method and keyboard filter driving improving keyboard input correctness

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610681143.2A CN106293132B (en) 2016-08-17 2016-08-17 A kind of method and keyboard filter driving improving keyboard input correctness

Publications (2)

Publication Number Publication Date
CN106293132A CN106293132A (en) 2017-01-04
CN106293132B true CN106293132B (en) 2019-03-05

Family

ID=57679682

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610681143.2A Active CN106293132B (en) 2016-08-17 2016-08-17 A kind of method and keyboard filter driving improving keyboard input correctness

Country Status (1)

Country Link
CN (1) CN106293132B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109725815B (en) * 2019-01-09 2021-02-23 北京数衍科技有限公司 Method for distinguishing data input of scanning gun and keyboard

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN2615743Y (en) * 2003-03-25 2004-05-12 联想(北京)有限公司 PS/2 keyboard with energy-saving and high driving capacity selection
US7426582B1 (en) * 2005-04-29 2008-09-16 American Megatrends, Inc. Method, system, and apparatus for servicing PS/2 devices within an extensible firmware interface environment
CN102053712A (en) * 2009-11-02 2011-05-11 研祥智能科技股份有限公司 Multi-keyboard input system, input equipment, switching device and control method
CN103534676A (en) * 2012-04-30 2014-01-22 黑莓有限公司 Touchscreen keyboard with correction of previously input text

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5925896B2 (en) * 2011-09-07 2016-05-25 シナプティクス インコーポレイテッド Capacitive detection during hidden update time

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN2615743Y (en) * 2003-03-25 2004-05-12 联想(北京)有限公司 PS/2 keyboard with energy-saving and high driving capacity selection
US7426582B1 (en) * 2005-04-29 2008-09-16 American Megatrends, Inc. Method, system, and apparatus for servicing PS/2 devices within an extensible firmware interface environment
CN102053712A (en) * 2009-11-02 2011-05-11 研祥智能科技股份有限公司 Multi-keyboard input system, input equipment, switching device and control method
CN103534676A (en) * 2012-04-30 2014-01-22 黑莓有限公司 Touchscreen keyboard with correction of previously input text

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
《基于Small RTOS51 的PS /2 键盘驱动程序开发》;王志国 等;;《单片机与嵌入式系统应用》;20061231(第7期);第28-29页;
《基于Windows CE PS 2/ 键盘的同步串口实现》;周英杰 等;;《现代电子技术》;20061231(第229期);第83-87页;

Also Published As

Publication number Publication date
CN106293132A (en) 2017-01-04

Similar Documents

Publication Publication Date Title
US7418057B2 (en) Distortion compensating apparatus, compressed data generating method
JP2005354278A5 (en)
US20130011076A1 (en) Method and Apparatus for Finding Data Quantisation Error
CN106060617B (en) Key function configuration method and system
CN106293132B (en) A kind of method and keyboard filter driving improving keyboard input correctness
CN114898693A (en) Gamma debugging method and device, display device and computer readable storage medium
CN107145363A (en) The driver loading method and terminal device of a kind of starting up of terminal process
US7436410B2 (en) System and method for programming a controller
US20090210613A1 (en) Method for Programming a Controller in a Motor Vehicle
CN114518109A (en) Zero offset compensation method of gyroscope
CN110096457B (en) Hardware control system and hardware control method
JP2002094639A (en) Mobile telephone, and method of rewriting software used for it, and storage medium having stored its control program
US20150026674A1 (en) Driver Installation Method and Apparatus for Terminal Device
CN104506311A (en) Method for achieving check-in function
US10388201B2 (en) Power cycle display sensing
JP2526181Y2 (en) Small electronic calculator
CN116386499A (en) Gamma correction method, driving circuit of display panel and display panel
CN114896246A (en) User manual generation method and system
US20070286529A1 (en) Table value conversion device and method for converting and writing table value
US20020129084A1 (en) Data processing apparatus and recording medium
CN117950754A (en) Vehicle function selecting and installing method, device, equipment and storage medium
JP2914538B2 (en) Programmable controller
CN114004350A (en) Neural network computing method, accelerator, and computer-readable storage medium
KR100980552B1 (en) Method to register schedule in mobile communication terminal
KR20140057878A (en) Data rstoration mehtod of re-programing and data rstoration apparatus

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant