Disclosure of Invention
Aiming at the problem that the channels selected after the last switching cannot be memorized after the KVM equipment is powered off and powered down. When the KVM device is powered up again, the keyboard and mouse functions are displayed and implemented from the first channel by default. For a user, the probability of continuously using the channel selected last time is very high, switching from the default first channel to the channel selected last time can be realized only by pressing the switching key for multiple times at most, the mode is complicated in operation, and the use experience of the user is greatly influenced.
The technical scheme of the invention is as follows:
in a first aspect, the present invention provides a device for implementing channel selection and memory of a KVM switch, including a single chip, wherein the single chip is connected to a switch button;
the single chip microcomputer comprises a key action detection module, a judgment module, a nonvolatile storage area, a processing module and an instruction output module;
the key action detection module is used for detecting the action of switching the keys;
the judging module is used for judging whether a channel variable value exists in the nonvolatile storage area after detecting the action of the switching key;
the instruction output module is used for outputting an instruction to default the first channel when the judging module judges that the value of the channel variable does not exist in the nonvolatile storage area; and the processor is also used for outputting a channel switching instruction according to the information obtained by the analysis of the processing module
The processing module is used for acquiring the value of the channel variable when the judging module judges that the value of the channel variable exists in the nonvolatile storage area and analyzing the acquired value; and the method is also used for storing the value of the current channel variable into the nonvolatile storage area when the switching action is completed.
After the current channel configuration is completed, the KVM switcher initializes the switching control action according to the value of the current channel variable, then the value of the current channel variable is stored in the nonvolatile storage area, and is timely updated after each switching action, so that the channel selection memory function is realized. The method is simple to operate, and the use experience of the user is improved.
Preferably, the device further comprises a dial switch for selecting whether the channel needs to be switched or not by setting the dial switch;
the single chip microcomputer also comprises a port state detection module, and the dial switch is connected with the single chip microcomputer;
the port state detection module is used for detecting the level state of a port of the singlechip connected with the dial switch when the key action detection module detects the key action;
the instruction output module is used for outputting an instruction to default the first channel when the output port of the port state detection module is at a high level;
and the judging module is used for judging whether the channel variable value exists in the nonvolatile storage area or not when the output port of the port state detecting module is at a low level.
In order to realize the high efficiency of use, set up dial switch and singlechip and be connected, set up the dialling ware through operating personnel according to the demand like this, the singlechip switches the action according to setting up control.
Preferably, the device also comprises an initialization module for carrying out general initialization configuration after the singlechip is powered on;
the singlechip also comprises a power-on judging module which is used for judging whether the singlechip is powered on for the first time;
the instruction output module is used for outputting an instruction to default the first channel when the power-on judgment module judges that the single chip microcomputer is powered on for the first time and the key action detection module detects the action of switching the keys;
and the port state detection module is specifically used for detecting the level state of the port for indicating the switching channel when the power-on judgment module judges that the single chip microcomputer is not powered on for the first time and the key action detection module detects the switching key action.
By monitoring the power-on state, the single chip microcomputer is powered on for the first time, namely no effective data exists in the nonvolatile storage area of the single chip microcomputer, so that the first channel is directly defaulted under the condition, subsequent judgment is not needed, the switching speed is increased, and the time is saved.
Preferably, a GPIO port of the singlechip is connected with the dial switch;
and the port state detection module is specifically used for detecting the level state of the GPIO port when the power-on judgment module judges that the single chip microcomputer is not powered on for the first time and the key action detection module detects the switching key action. The set value of the dial switch is read through detecting the GPIO level, and the user experience is further improved.
In a second aspect, the present invention provides a system for implementing channel selection and memory of a KVM switch, a device for channel selection and memory, and a KVM switch;
the channel selection memory device is the device for realizing the channel selection memory of the KVM switch in the first aspect;
the command output module is connected with the KVM switcher and used for outputting a control command to control the KVM switcher to switch channels.
Preferably, the system further comprises a power module;
the power module is connected with the single chip microcomputer and used for supplying power to the point single chip microcomputer.
Preferably, the system further comprises a control module;
the control module is connected with the power supply module and used for controlling the power supply module to automatically power on the single chip microcomputer. And automation of the system switching process is realized.
In a third aspect, the present invention further provides a method for switching channel selection memory of a KVM switch, including the following steps:
after detecting the action of the switching key, judging whether a channel variable value exists in the nonvolatile storage area;
if not, defaulting the first channel;
if so, acquiring the value of the channel variable, and analyzing the acquired value;
controlling channel switching action according to the analyzed information output instruction;
and storing the value of the current channel variable into a nonvolatile storage area.
After the current channel configuration is completed, the KVM switcher initializes the switching control action according to the value of the current channel variable, then the value of the current channel variable is stored in the nonvolatile storage area, and is timely updated after each switching action, so that the channel selection memory function is realized. The method is simple to operate, and the use experience of the user is improved.
Preferably, after detecting the action of the switching key, the step of judging whether the value of the channel variable exists in the nonvolatile storage area comprises the following steps;
detecting the state of a switching key;
after detecting the action of the switching key, detecting the level state of a port for indicating a switching channel;
defaulting the first channel when the port is at a high level;
and when the port is at a low level, judging whether the value of the channel variable exists in the nonvolatile storage area.
Preferably, the step of detecting the state of the switching key further comprises:
powering on the single chip microcomputer, and carrying out general initialization configuration;
judging whether the single chip microcomputer is powered on for the first time;
if yes, after detecting the action of the switching key, defaulting the first channel;
if not, after detecting the action of the switching key, detecting the level state of the port for indicating the switching channel.
By monitoring the power-on state, the single chip microcomputer is powered on for the first time, namely no effective data exists in the nonvolatile storage area of the single chip microcomputer, so that the first channel is directly defaulted under the condition, subsequent judgment is not needed, the switching speed is increased, and the time is saved.
According to the technical scheme, the invention has the following advantages: in order to realize the channel selection memory function, the single chip microcomputer needs to record the current latest switched channel value into the nonvolatile storage area after detecting the action of the switching key and while executing the function of KVM switching control action. The single chip can be stored for a long time without loss after being powered off. Therefore, the single chip microcomputer immediately stores the data of the current channel variable originally stored in the RAM space lost in power failure into the nonvolatile storage area in the single chip microcomputer while executing the KVM switching control action each time. The method is simple to operate, and the use experience of the user is improved.
In addition, the invention has reliable design principle, simple structure and very wide application prospect.
Therefore, compared with the prior art, the invention has prominent substantive features and remarkable progress, and the beneficial effects of the implementation are also obvious.
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly and completely described below with reference to the drawings in the embodiment of the present invention, and it is obvious that the described embodiment is only a part of the embodiment of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. The following explains key terms appearing in the present invention.
As shown in fig. 1, an embodiment of the present invention provides an apparatus for implementing channel selection memory of a KVM switch, including a single chip 10 connected to a switch button 20;
the single chip microcomputer 10 comprises a key action detection module 101, a judgment module 102, a nonvolatile storage area 103, a processing module 104 and an instruction output module 105;
a key action detection module 101, configured to detect an action of switching a key;
the judging module 102 is configured to judge whether a value of a channel variable exists in the nonvolatile storage area 103 after detecting a switching key action;
an instruction output module 105, configured to output an instruction to initialize and configure a current channel as a first channel, that is, a default first channel, when the determining module 102 determines that the value of the channel variable does not exist in the nonvolatile storage area 103; the channel switching module is further configured to output a channel switching instruction according to the information obtained by the analysis of the processing module 104;
the processing module 104 is configured to, when the determining module 102 determines that the value of the channel variable exists in the nonvolatile storage area 103, obtain the value of the channel variable, and analyze the obtained value; and also for storing the value of the current channel variable in the non-volatile storage area 104 when the switching action is completed.
After the current channel configuration is completed, the KVM switcher initializes the switching control action according to the value of the current channel variable, then the value of the current channel variable is stored in the nonvolatile storage area, and is timely updated after each switching action, so that the channel selection memory function is realized. The method is simple to operate, and the use experience of the user is improved.
The embodiment of the invention provides a device for realizing KVM switch channel selection memory, which comprises a single chip microcomputer, wherein a switch button 20 is connected to the single chip microcomputer 10;
the single chip microcomputer 10 comprises a key action detection module 101, a judgment module 102, a nonvolatile storage area 103, a processing module 104 and an instruction output module 105;
a key action detection module 101, configured to detect an action of switching a key;
the judging module 102 is configured to judge whether a value of a channel variable exists in the nonvolatile storage area 103 after detecting a switching key action;
an instruction output module 105, configured to output an instruction to initialize and configure a current channel as a first channel, that is, a default first channel, when the determining module 102 determines that the value of the channel variable does not exist in the nonvolatile storage area 103; the channel switching module is further configured to output a channel switching instruction according to the information obtained by the analysis of the processing module 104;
the processing module 104 is configured to, when the determining module 102 determines that the value of the channel variable exists in the nonvolatile storage area 103, obtain the value of the channel variable, and analyze the obtained value; and also for storing the value of the current channel variable in the non-volatile storage area 104 when the switching action is completed.
The device also comprises a dial switch 30, which is used for selecting whether the channel needs to be switched or not by setting the dial switch 30;
the single chip microcomputer 10 further comprises a port state detection module 106, and the dial switch 30 is connected with the single chip microcomputer 10;
the port state detection module 106 is used for detecting the level state of a port of the single chip microcomputer connected with the dial switch when the key action detection module 101 detects the key action;
an instruction output module 105, configured to output an instruction to initialize and configure a current channel as a first channel, that is, a default first channel, when an output port of the port state detection module 106 is at a high level;
the determining module 102 is configured to determine whether a value of a channel variable exists in the nonvolatile memory area 103 when the output port of the port status detecting module 106 is at a low level.
In order to realize the high efficiency of use, set up dial switch and singlechip and be connected, set up the dialling ware through operating personnel according to the demand like this, the singlechip switches the action according to setting up control.
It should be noted that the apparatus further includes an initialization module 107, configured to perform general initialization configuration after the single chip microcomputer 10 is powered on;
the single chip microcomputer 10 further comprises a power-on judging module 108 for judging whether the single chip microcomputer 10 is powered on for the first time;
the instruction output module 105 is configured to output an instruction to initialize and configure a current channel as a first channel, that is, a default first channel, when the power-on judgment module 108 judges that the single chip microcomputer is powered on for the first time and the key action detection module 101 detects a switching key action;
the port state detection module 106 is specifically configured to detect a level state of a port of the single chip microcomputer 10 connected to the dial switch 30 when the power-on judgment module 108 judges that the single chip microcomputer is not powered on for the first time and the key action detection module 101 detects a switching key action.
By monitoring the power-on state, because the single chip microcomputer is powered on for the first time, namely no effective data exists in the nonvolatile storage area of the single chip microcomputer, in this situation, the current channel is initialized and configured to be the first channel, namely the first channel is directly acquiescent, subsequent judgment is not needed, the switching speed is improved, and the time is saved.
It is further noted that a GPIO port of the single chip is connected with the dial switch; the port state detection module 106 is specifically configured to detect the level state of the GPIO port when the power-on determination module 108 determines that the single chip microcomputer is not powered on for the first time and the key action detection module 101 detects a switching key action. The set value of the dial switch is read through detecting the GPIO level, and the user experience is further improved.
As shown in fig. 2, the present invention further provides a system for implementing channel selection memory of a KVM switch, a device 1 for channel selection memory and a KVM switch 2;
the channel selection memory device 1 comprises a singlechip 10, wherein the singlechip 10 is connected with a switching key 20;
the single chip microcomputer 10 comprises a key action detection module 101, a judgment module 102, a nonvolatile storage area 103, a processing module 104 and an instruction output module 105;
a key action detection module 101, configured to detect an action of switching a key;
the judging module 102 is configured to judge whether a value of a channel variable exists in the nonvolatile storage area 103 after detecting a switching key action;
an instruction output module 105, configured to output an instruction to initialize and configure a current channel as a first channel, that is, a default first channel, when the determining module 102 determines that the value of the channel variable does not exist in the nonvolatile storage area 103; the channel switching module is further configured to output a channel switching instruction according to the information obtained by the analysis of the processing module 104;
the processing module 104 is configured to, when the determining module 102 determines that the value of the channel variable exists in the nonvolatile storage area 103, obtain the value of the channel variable, and analyze the obtained value; and also for storing the value of the current channel variable in the non-volatile storage area 104 when the switching action is completed.
The device also comprises a dial switch 30, which is used for selecting whether the channel needs to be switched or not by setting the dial switch 30;
the single chip microcomputer 10 further comprises a port state detection module 106, and the dial switch 30 is connected with the single chip microcomputer 10;
the port state detection module 106 is used for detecting the level state of a port of the single chip microcomputer connected with the dial switch when the key action detection module 101 detects the key action;
an instruction output module 105, configured to output an instruction to initialize and configure a current channel as a first channel, that is, a default first channel, when an output port of the port state detection module 106 is at a high level;
the determining module 102 is configured to determine whether a value of a channel variable exists in the nonvolatile memory area 103 when the output port of the port status detecting module 106 is at a low level.
In order to realize the high efficiency of use, set up dial switch and singlechip and be connected, set up the dialling ware through operating personnel according to the demand like this, the singlechip switches the action according to setting up control.
It should be noted that the apparatus further includes an initialization module 107, configured to perform general initialization configuration after the single chip microcomputer 10 is powered on;
the single chip microcomputer 10 further comprises a power-on judging module 108 for judging whether the single chip microcomputer 10 is powered on for the first time;
the instruction output module 105 is configured to output an instruction to initialize and configure a current channel as a first channel, that is, a default first channel, when the power-on judgment module 108 judges that the single chip microcomputer is powered on for the first time and the key action detection module 101 detects a switching key action;
the port state detection module 106 is specifically configured to detect a level state of a port of the single chip microcomputer 10 connected to the dial switch 30 when the power-on judgment module 108 judges that the single chip microcomputer is not powered on for the first time and the key action detection module 101 detects a switching key action.
By monitoring the power-on state, the single chip microcomputer is powered on for the first time, namely no effective data exists in the nonvolatile storage area of the single chip microcomputer, so that the first channel is directly defaulted, namely the current channel is initialized and configured into the first channel, subsequent judgment is not needed, the switching speed is increased, and the time is saved.
It is further noted that a GPIO port of the single chip is connected with the dial switch; the port state detection module 106 is specifically configured to detect the level state of the GPIO port when the power-on determination module 108 determines that the single chip microcomputer is not powered on for the first time and the key action detection module 101 detects a switching key action. The set value of the dial switch is read through detecting the GPIO level, and the user experience is further improved.
The command output module 105 is connected to the KVM switch 2, and is configured to output a control command to control the KVM switch 2 to perform channel switching.
It should be noted that the system further includes a power module 5 and a control module 6;
the power module 5 is connected with the single chip microcomputer 10 and used for supplying power to the single chip microcomputer 10.
And the control module 6 is connected with the power supply module 5 and is used for controlling the power supply module to automatically power on the singlechip. And automation of the system switching process is realized.
As shown in FIG. 3, an embodiment of the present invention further provides a switching method for selecting a memory for a KVM switch channel, comprising the following steps:
step 11: after detecting the action of the switching key, detecting the variable value of the channel in the nonvolatile storage area, and judging whether the value of the channel variable exists or not; if yes, go to step 13, otherwise, go to step 12;
step 12: initializing and configuring a current channel into a first channel; the default first channel; step 15 is executed;
step 13: acquiring a value of a channel variable, and analyzing the acquired value;
step 14: controlling channel switching action according to the analyzed information output instruction;
step 15: and storing the value of the current channel variable into a nonvolatile storage area.
After the current channel configuration is completed, the KVM switcher initializes the switching control action according to the value of the current channel variable, then the value of the current channel variable is stored in the nonvolatile storage area, and is timely updated after each switching action, so that the channel selection memory function is realized. The method is simple to operate, and the use experience of the user is improved.
As shown in fig. 4, an embodiment of the present invention further provides a method for switching a channel selection memory of a KVM switch, including the following steps:
step 21: powering on the single chip microcomputer, and carrying out general initialization configuration;
step 22: detecting the state of a switching key;
step 23: after detecting the action of the switching key, judging whether the singlechip is powered on for the first time; if yes, go to step 28; if not, executing step 24;
step 24: detecting a level state of a port for indicating switching of a channel; when the port is at high level, executing step 28, and when the port is at low level, executing step 25;
step 25: detecting the variable value of a channel in the nonvolatile storage area, and judging whether the value of the channel variable exists or not; if yes, go to step 26, otherwise go to step 28;
step 26: acquiring a value of a channel variable, and analyzing the acquired value;
step 27: controlling channel switching action according to the analyzed information output instruction; step 29 is executed;
step 28: initializing and configuring a current channel into a first channel; i.e. defaults to the first channel, step 29 is performed;
step 29: and storing the value of the current channel variable into a nonvolatile storage area.
By monitoring the power-on state, the single chip microcomputer is powered on for the first time, namely no effective data exists in the nonvolatile storage area of the single chip microcomputer, so that the first channel is directly defaulted under the condition, subsequent judgment is not needed, the switching speed is increased, and the time is saved.
In order to realize the channel selection memory function, the single chip microcomputer needs to record the current latest switched channel value into the nonvolatile storage area after detecting the action of the switching key and while executing the function of KVM switching control action. In the process of executing the single chip microcomputer, variables are generally stored in volatile storage areas such as an RAM (random access memory), and once the KVM (keyboard, video and mouse) equipment is powered off, data of current channel value variables stored in the single chip microcomputer are lost. The variable storage device stores the variable value into the nonvolatile storage area of the single chip microcomputer, and the single chip microcomputer can be stored for a long time without loss after being powered off. Therefore, the single chip microcomputer immediately stores the value of the current channel variable originally stored in the RAM space lost in power failure into the nonvolatile storage area in the single chip microcomputer while executing the KVM switching control action each time.
After the single chip microcomputer is electrified again, general initialization configuration is firstly carried out, and then the level state of the GPIO connected with the dial switch is detected. When the high level state is carried out, the current channel is initialized and configured to be the first channel; in a low level state, the variable value of the historical channel in the nonvolatile storage area is firstly inquired, and then the current channel is configured as the channel before the last shutdown (if the single chip microcomputer is powered on for the first time, namely no valid data exists in the nonvolatile storage area, the first channel is defaulted). After the current channel configuration is completed, executing KVM initialization switching control action according to the value of the current channel variable, then storing the value of the current channel variable into a nonvolatile storage area, and updating in time after each switching action, thereby realizing the channel selection memory function.
Although the present invention has been described in detail by referring to the drawings in connection with the preferred embodiments, the present invention is not limited thereto. Various equivalent modifications or substitutions can be made on the embodiments of the present invention by those skilled in the art without departing from the spirit and scope of the present invention, and these modifications or substitutions are within the scope of the present invention/any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.