A kind of keyboard adds unlocking method, system and keyboard
Technical field
The invention belongs to field of computer technology, more particularly to a kind of keyboard to add unlocking method, system and keyboard.
Background technology
The keyboard input equipment main as electronic equipments such as computers, since its is easy to operate, data entry mode is simple
The features such as list and low cost, play a part of being difficult to substitute in terms of information input, however, due to keyboard in the prior art
(for example, PC/AT compatible keyboards) or key-press matrix can not realize self-locking function so that user need not use keyboard when
Wait, it is difficult to easily locking/closing keyboard function, to prevent the evil of user itself the maloperation or other users produced therefrom
Meaning behavior.
Keyboard lockout can be realized by way of application software in the prior art, but the application software is needed in system
Running background, adds overhead, while application software depends on operating system, in addition, for muliple keyboards, triggering keyboard is opened
After opening locking, all keyboards for being connected to same host can not be used, it is impossible to accomplish from locking, if user illegally terminates
After falling the application program, keypad lock will fail.The unlock/lock of mobile terminal (for example, mobile phone) is also based on this mode reality
Existing, when unlocking/locking, mobile terminal can enter different operating statuses in itself, waste system resource.Therefore,
There is an urgent need to a kind of keyboard locking method to solve the above problems.
The content of the invention
The purpose of the embodiment of the present invention is that providing a kind of keyboard adds unlocking method, it is intended to solves since the prior art can not
A kind of effective computer keyboard is provided and adds unlocking method, cause to be difficult to easily to lock/closing keyboard function the problem of.
The embodiment of the present invention is achieved in that a kind of keyboard adds unlocking method, and the described method includes following step:
Obtain on keyboard button push and/or unclamp and operate corresponding command code, the command code for scan code or
Position code;
When the command code is the first predetermined registration operation code, judge whether the keyboard has locked;
When the keyboard has locked, it is allowed to which the keyboard, releases the locking of the keyboard;
When the keyboard is unlocked, forbids the keyboard, be locked the keyboard.
The another object of the embodiment of the present invention is that providing a kind of keyboard adds system for unlocking, the system comprises:
Command code acquiring unit, for obtaining button push on keyboard and/or unclamping the corresponding command code of operation, institute
It is scan code or position code to state command code;
Judging unit, when the command code for being obtained when the command code acquiring unit is the first predetermined registration operation code, judges
Whether the keyboard has locked;
Keyboard unlocking unit, for when the keyboard has locked, it is allowed to which the keyboard, releases the locking of the keyboard;
And
Keyboard lockout unit, for when the keyboard is unlocked, forbidding the keyboard, being locked the keyboard.
The another object of the embodiment of the present invention is to provide a kind of keyboard for adding system for unlocking including above-mentioned keyboard.
The embodiment of the present invention is described by obtaining button push on keyboard and/or unclamping the corresponding command code of operation
Command code is scan code or position code, when the command code is the first predetermined registration operation code, judges whether the keyboard has locked,
When the keyboard has locked, it is allowed to which the keyboard, releases the locking of the keyboard, otherwise forbid the keyboard, make the key
Disk is locked, so that the unlock and locking of keyboard are realized in the keyboard controller of keyboard itself, without upper application software
Support to can be achieved the locking and unlock of keyboard, saved system resource, and keyboard locking and unlock and operating system without
Close, improve its application range.
Brief description of the drawings
Fig. 1 be the keyboard that the embodiment of the present invention one provides add unlocking method realize flow chart;
Fig. 2 be keyboard provided by Embodiment 2 of the present invention add unlocking method realize flow chart;
Fig. 3 be the keyboard that the embodiment of the present invention three provides add unlocking method realize flow chart;
Fig. 4 be the keyboard that the embodiment of the present invention four provides add unlocking method realize flow chart;
Fig. 5 is the structure chart that the keyboard that the embodiment of the present invention five provides adds system for unlocking;
Fig. 6 is the structure chart that the keyboard that the embodiment of the present invention six provides adds system for unlocking.
Embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, with reference to the accompanying drawings and embodiments, it is right
The present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and
It is not used in the restriction present invention.
It is described in detail below in conjunction with specific implementation of the specific embodiment to the present invention:
Embodiment one:
Fig. 1 shows that what the keyboard that the embodiment of the present invention one provides added unlocking method realizes flow, and details are as follows:
In step S101, obtain button push on keyboard and/or unclamp the corresponding command code of operation, the operation
Code is scan code or position code.
In embodiments of the present invention, keyboard can be the compatible keyboard of PC/AT, commonly referred to as AT-PS/2 compatible keyboards, one
As there are 101~104 buttons, by keyboard key encoder detect and scan all button pushes and/or unclamp grasp
The column locations of work, are referred to herein as position code.Keyboard may also be other types of keystroke sequence, herein not limiting this
Invention.In specific implementation process, the command code of acquisition can be scan code or position code, and wherein scan code is pressed for keyboard
Lower operation and/or release operation correspondence position code concentrates corresponding scan code in keyboard scancode, and scanning code collection can be XT keys
Code collection, AT keyboard scanning code collection or PS/2 keyboard scan code collections etc. are retouched in sweeping.
In step s 102, when the command code is the first predetermined registration operation code, judge whether the keyboard has locked, be
Step S103 is then performed, otherwise performs step S104.
In embodiments of the present invention, the first predetermined registration operation code is the corresponding operation of the combination button for pre-setting or storing
Code, specifically, according to the type (i.e. scan code or position code) of the step S101 command codes obtained, which corresponds to
Ground can be scan code or position code, the combination button be user setting plus/solving locking key, after receiving command code, if connecing
When received command code is the first predetermined registration operation code, then show add/solving locking key of the combination button for user setting, and then, sentence
Whether scission of link disk has locked, and specifically, can pass through the value for a state flag bit for obtaining keyboard controller internal custom
To judge whether keyboard has locked.
In step s 103, when the keyboard has locked, it is allowed to which the keyboard, releases the locking of the keyboard.
In embodiments of the present invention, when the command code received is the first predetermined registration operation code, and judge in step S102
When the keyboard has locked, it is allowed to which the keyboard, releases the locking of the keyboard.
In step S104, when the keyboard is unlocked, forbids the keyboard, be locked the keyboard.
In embodiments of the present invention, when the command code received is the first predetermined registration operation code, and judge in step S102
When the keyboard is unlocked, forbids the keyboard, be locked the keyboard, locking (locking) process is opposite with releasing process
Should.
In embodiments of the present invention, keyboard is carried out in keyboard controller adding/unlock, at the middle and upper levels should without operating system
It is that the locking and unlock of keyboard can be achieved with the support of software, has saved system resource, and the locking and unlock of keyboard and behaviour
It is unrelated to make system, improves its application range.
Embodiment two:
In embodiments of the present invention, when command code is scan code, it is necessary to first by button push and/or pine on keyboard
The scan code that operation correspondence position code is converted to keyboard scan code collection is opened, then is contrasted with the first default scan code, so that complete
Into the locking or unlock of keyboard.
Fig. 2 shows that what keyboard provided by Embodiment 2 of the present invention added unlocking method realizes flow, and details are as follows:
In step s 201, button push and/or release operation are corresponding on control keyboard encoder detection keyboard
Position code.
In step S202, the position code detected is received, obtains the corresponding scan code of the position code.
In embodiments of the present invention, when receiving the position code detected, the corresponding scan code of the position code is obtained,
Specifically, the scan code corresponding to scan code Integrated query position code that can be used according to position code in keyboard, sweeps so as to obtain
Retouch code.
In step S203, when the scan code presets scan code for first, judge whether the keyboard has locked, be
Step S204 is then performed, otherwise performs step S205.
In embodiments of the present invention, the first default scan code is the corresponding scanning of the combination button for pre-setting or storing
Code, the combination button be user setting plus/solving locking key, after receiving scan code, if the scan code received is first pre-
If during scan code, then show add/solving locking key of the combination button for user setting, and then, judge whether keyboard has locked, specifically
Ground, can judge whether keyboard has locked by the value for a state flag bit for obtaining keyboard controller internal custom.
In step S204, when the keyboard has locked, it is allowed to which the keyboard, releases the locking of the keyboard.
In embodiments of the present invention, when the scan code received presets scan code for first, and judge in step S203
When the keyboard has locked, it is allowed to which the keyboard, releases the locking of the keyboard.Further, keyboard controller is reset
One state flag bit of internal custom, to represent that the keyboard has unlocked.After keyboard unlock, when the scan code received is
During the non-first default scan code, scan code is sent in default caching, so that connected equipment can be to sweeping
Retouch code and the operation such as be read out.
In step S205, when the keyboard is unlocked, forbids the keyboard, be locked the keyboard.
In embodiments of the present invention, when the scan code received presets scan code for first, and judge in step S203
When the keyboard is unlocked, forbids the keyboard, be locked the keyboard, locking (locking) process is opposite with releasing process
Should.Further, a state flag bit of keyboard controller internal custom is reset, to represent that the keyboard has been locked
It is fixed.After keyboard lockout, when the scan code received for the non-first default scan code when, the scan code of acquisition is abandoned, described in holding
The lock-out state of keyboard, so that connected equipment can not read scan code, finally realizes the locking to keyboard, compared with
Excellently, released state and the flag bit of locking (locking) state are same flag bit.
Embodiment three:
In embodiments of the present invention, directly position code can be judged, i.e., directly should when command code is position code
Position code is contrasted with the first predeterminated position code, completes the locking or unlock of keyboard, so as to improve the operational efficiency of system.
Fig. 3 shows that what the keyboard that the embodiment of the present invention three provides added unlocking method realizes flow, and details are as follows:
In step S301, button push and/or release operation are corresponding on control keyboard encoder detection keyboard
Position code, obtains the position code detected.
In step s 302, when the position code is the first predeterminated position code, judge whether the keyboard has locked, be
Step S303 is then performed, otherwise performs step S304.
In embodiments of the present invention, the first predeterminated position code is the corresponding position of the combination button for pre-setting or storing
Code, the combination button be user setting plus/solving locking key, after receiving position code, if the position code received is first pre-
If during position code, then show add/solving locking key of the combination button for user setting, and then, judge whether keyboard has locked, specifically
Ground, can judge whether keyboard has locked by the value for a state flag bit for obtaining keyboard controller internal custom.
In step S303, when the keyboard has locked, it is allowed to which the keyboard, releases the locking of the keyboard.
In embodiments of the present invention, when the position code received is the first predeterminated position code, and judge in step S302
When the keyboard has locked, it is allowed to which the keyboard, releases the locking of the keyboard.Further, keyboard controller is reset
One state flag bit of internal custom, to represent that the keyboard has unlocked.After keyboard unlock, when the position code received is
During non-first predeterminated position code, position code is converted into corresponding scan code and is sent in default caching, so that with
Its equipment connected such as can be read out transformed scan code at the operation.
In step s 304, when the keyboard is unlocked, forbid the keyboard, be locked the keyboard.
In embodiments of the present invention, when the position code received is the first predeterminated position code, and judge in step S302
When the keyboard is unlocked, forbids the keyboard, be locked the keyboard, locking (locking) process is opposite with releasing process
Should.Further, a state flag bit of keyboard controller internal custom is reset, to represent that the keyboard has been locked
It is fixed.After keyboard lockout, when the position code received is non-first predeterminated position code, the position code of acquisition is abandoned, described in holding
The lock-out state of keyboard, so that connected equipment can not read the corresponding scan code of position code, final realization pair
The locking of keyboard, more preferably, released state and the flag bit for locking (locking) state are same flag bit.
Example IV:
Fig. 4 shows that what the keyboard that the embodiment of the present invention four provides added unlocking method realizes flow, and details are as follows:
In step S401, obtain button push on keyboard and/or unclamp the corresponding command code of operation, the operation
Code is scan code or position code.
In embodiments of the present invention, keyboard can be the compatible keyboard of PC/AT, commonly referred to as AT-PS/2 compatible keyboards, one
As there are 101~104 buttons, by keyboard key encoder detect and scan all button pushes and/or unclamp grasp
The column locations of work, are referred to herein as position code.Keyboard may also be other types of keystroke sequence, herein not limiting this
Invention.In specific implementation process, the command code of acquisition can be scan code or position code, and wherein scan code is pressed for keyboard
Lower operation and/or release operation correspondence position code concentrates corresponding scan code in default scan code, and scanning code collection can be XT keys
Code collection, AT keyboard scanning code collection or PS/2 keyboard scan code collections etc. are retouched in sweeping.
In step S402, when the command code is the first predetermined registration operation code, judges whether the keyboard has locked, be
Step S403 is then performed, otherwise performs step S406.
In embodiments of the present invention, the first predetermined registration operation code is the corresponding operation of the combination button for pre-setting or storing
Code, specifically, according to the type (i.e. scan code or position code) of the step S401 command codes obtained, which corresponds to
Ground can be scan code or position code, the combination button be user setting plus/solving locking key, after receiving command code, if connecing
When received command code is the first predetermined registration operation code, then show add/solving locking key of the combination button for user setting, and then judge
Whether keyboard has locked, specifically, can by obtain keyboard controller internal custom a state flag bit value come
Judge whether keyboard has locked.
In step S403, when the keyboard has locked, wait and obtain on the keyboard button push and/or
Unclamp and operate corresponding verification operation code.
In step s 404, judge whether verification operation code is the second predetermined registration operation code, be then to perform step S405, otherwise
Perform step S407.
In embodiments of the present invention, in order to further ensure system is safe, the verification operation of the unlock of keyboard can be set
Code, specifically, in order to clearly prompt user's input validation button, and then obtains corresponding verification operation code, can work as
When scan code in step S402 is the first predetermined registration operation code, that is, the combination button that inputs be user setting plus/solving locking key,
Can be flickered successively by " caps-lock " on keyboard, " num-lock " or " scroll-lock " lamp, it is single flicker or its
The mode for combining flicker prompts user's input validation command code, so as to further strengthen the security of keyboard.
Wherein, the second predetermined registration operation code is the corresponding verification operation code of verification button for pre-setting or storing, this is tested
The authenticating user identification button that button is user setting is demonstrate,proved, after receiving verification operation code, if the verification operation code received is
During the second predetermined registration operation code, then show the authenticating user identification button that the verification button is user setting, and then perform step
S405, otherwise performs step S407.In specific implementation process, the setting of the second predetermined registration operation code can step S401 it
Before, after user's input plus/solving locking key locking keyboard, if being not provided with the second predetermined registration operation code, user setting second can be prompted pre-
If command code, specifically, obtain button push on keyboard and/or unclamp the corresponding command code of operation, which is set
The second predetermined registration operation code is set to, realizes the setting of the second predetermined registration operation code.
In step S405, when the verification operation code is the second predetermined registration operation code, it is allowed to which the keyboard, releases
The locking of the keyboard.
In embodiments of the present invention, when the verification operation code received is the second predetermined registration operation code, it is allowed to the keyboard,
The locking of the keyboard is released, specifically identical with implementing the releasing process in two and embodiment three, details are not described herein.
In step S406, when the keyboard is unlocked, forbids the keyboard, be locked the keyboard.
In embodiments of the present invention, when the command code received is the first predetermined registration operation code, and judge in step S402
When the keyboard is unlocked, forbids the keyboard, be locked the keyboard, locking (locking) process is opposite with releasing process
Should, specifically identical with implementing the locking process in two and embodiment three, details are not described herein.
In step S 407, when verification operation code is not the second predetermined registration operation code, the lock-out state of the keyboard is kept,
In this locked condition, the keyboard is prohibited.
In embodiments of the present invention, when the release tab that keyboard has been locked and is inputted is default with pre-set first
Command code is identical, but when verifying that the corresponding command code of button is different from pre-set second predetermined registration operation code, keeps keyboard
Lock-out state, in this locked condition, keyboard are prohibited, so as to further increase the security of system.
Embodiment five:
Fig. 5 shows that the keyboard that the embodiment of the present invention five provides adds the structure of system for unlocking, which can be used for calculating
In switch disk or other keystroke sequences with input function, for convenience of description, it illustrate only related to the embodiment of the present invention
Part, including:
Command code acquiring unit 51 obtains button push on keyboard and/or unclamps the corresponding command code of operation, described
Command code is scan code or position code.
Judging unit 52 judges the key when the command code that command code acquiring unit 51 obtains is the first predetermined registration operation code
Whether disk has locked.
Keyboard unlocking unit 53 is when the keyboard has locked, it is allowed to which the keyboard, releases the locking of the keyboard.
Keyboard lockout unit 54 forbids the keyboard, is locked the keyboard when the keyboard is unlocked.
In embodiments of the present invention, keyboard is carried out in keyboard controller adding/unlock, at the middle and upper levels should without operating system
It is that the locking and unlock of keyboard can be achieved with the support of software, has saved system resource, and the locking and unlock of keyboard and behaviour
It is unrelated to make system, improves its application range.
Embodiment six:
Fig. 6 shows that the keyboard that the embodiment of the present invention six provides adds the structure of system for unlocking, which can be used for calculating
In switch disk or other keystroke sequences with input function, for convenience of description, it illustrate only related to the embodiment of the present invention
Part, including:
Command code acquiring unit 60 obtains button push on keyboard and/or unclamps the corresponding command code of operation, described
Command code is scan code or position code.
In specific implementation process, the corresponding command code is scan code or position code, the command code acquiring unit 60
It can include scan code and obtain subelement or position code acquisition subelement, wherein, scan code obtains subelement and is used for control keyboard
Button push and/or release operate corresponding position code on encoder detection keyboard, receive the position code detected, obtain
The corresponding scan code of the position code, position code obtain subelement and are used on control keyboard encoder detection keyboard grasp by key pressing
Make and/or unclamp to operate corresponding position code, obtain the position code detected.
Judging unit 61 judges the key when the command code that command code acquiring unit 60 obtains is the first predetermined registration operation code
Whether disk has locked.
Verification operation code acquiring unit 62 waits and obtains button push on the keyboard and/or unclamp operation correspondence
Verification operation code.
Trigger element 63 triggers the keyboard unlocking unit when the verification operation code is the second predetermined registration operation code
The step of 64 execution allow the keyboard, release the locking of the keyboard.
Keyboard unlocking unit 64 allows the keyboard, releases the locking of the keyboard.
Keyboard lockout unit 67 forbids the keyboard, is locked the keyboard when the keyboard is unlocked.
Second state holding elements 69 are not described second when the verification operation code that verification operation code acquiring unit 62 obtains
During predetermined registration operation code, the verification operation code is abandoned, keeps the lock-out state of the keyboard, it is described under the lock-out state
Keyboard is prohibited.
Further, when the command code received is non-first predetermined registration operation code, and keyboard is unlocked, the system is also
Including:
The command code is sent to default slow by the first scan code buffer unit 65 when the command code is scan code
In depositing.
The command code is converted to scan code simultaneously by the second scan code buffer unit 66 when the command code is position code
It is sent in default caching.
Further, when the command code received is non-first predetermined registration operation code, and the keyboard has locked, the system
System further includes:
First state holding unit 68, for abandoning the command code, keeps the lock-out state of the keyboard, in the lock
Determine under state, the keyboard is prohibited.
The embodiment of the present invention is by obtaining button push on keyboard and/or unclamping the corresponding command code of operation, when this
When command code is the first predetermined registration operation code, judge whether the keyboard has locked, when the keyboard has locked, further,
The corresponding second predetermined registration operation code of verification button input by user is verified, when corresponding second predetermined registration operation of the verification button of input
When code is correct, it is allowed to the keyboard, releases the locking of the keyboard, further enhances the security of keyboard operation and system,
When the keyboard is unlocked, forbids the keyboard, be locked the keyboard, so that in the keyboard controller of keyboard itself
Realize the unlock and locking of keyboard, the support without upper application software is that the locking and unlock of keyboard can be achieved, and has saved and is
System resource, and the locking and unlock of keyboard are unrelated with operating system, improve its application range.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the invention, all essences in the present invention
All any modification, equivalent and improvement made within refreshing and principle etc., should all be included in the protection scope of the present invention.