Virtual serial port parameter configuration method, device, electronic device and storage medium
By establishing a command channel between the upper computer and the serial port gateway and transmitting serial port parameters, the problem of cumbersome configuration of serial port equipment is solved, and the user can directly complete the configuration on the upper computer, improving the user experience.
Patent Information
- Application Number
- CN202410170698.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-06
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-02-06
AI Technical Summary
In the prior art, the serial port parameter configuration of serial port devices is complicated and the user experience is poor.
Establish a command channel between the upper computer and the serial port gateway to transmit serial port parameters. When the user configures the serial port parameters of the virtual serial port on the upper computer, the parameters are transmitted to the serial port gateway through the command channel, so that it sets the parameters of the physical serial port according to the parameters of the virtual serial port.
This enables users to directly configure the serial port parameter of the serial port device on the upper computer, simplifying the configuration process and improving the user experience.
Smart Images

Figure CN118012808B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a virtual serial port parameter configuration method, device, electronic device and storage medium. Background Art
[0002] A virtual serial port refers to a serial communication interface simulated by software. In the absence of an actual hardware serial port, the virtual serial port established on the host computer can still use serial communication for data transmission and control, thereby realizing data interaction between the host computer and the serial port device.
[0003] In some business scenarios, the serial port parameters of the physical serial port on the serial port device change. At this time, the technicians need to configure the serial port parameters of the physical serial port in time to make the serial port parameters of the physical serial port match the serial port parameters of the virtual serial port, thereby ensuring communication between the host computer and the serial port device.
[0004] However, when users configure the serial port parameters of serial port devices, they need to use specific debugging equipment or applications to set the serial port parameters of serial port devices in the serial port gateway to which the serial port devices are connected. They cannot directly complete the configuration of the serial port parameters of serial port devices on the host computer, resulting in cumbersome serial port parameter configuration operations for serial port devices and poor user experience. Summary of the invention
[0005] The present application provides a virtual serial port parameter configuration method, device, electronic device and storage medium to solve the technical problems in the prior art of cumbersome serial port parameter configuration operation for serial port devices and poor user experience.
[0006] In a first aspect, the present application provides a virtual serial port parameter configuration method, which is applied to a host computer, and the method comprises:
[0007] Establishing a command channel; wherein the command channel is set between the host computer and the serial port gateway, and the command channel is used to transmit serial port parameters;
[0008] In response to a parameter configuration operation by a user, obtaining a first serial port parameter corresponding to the parameter configuration operation; wherein the first serial port parameter is a serial port parameter of a virtual serial port in a host computer;
[0009] The first serial port parameters are sent to the serial port gateway through the command channel, so that the serial port gateway sets the second serial port parameters according to the first serial port parameters; wherein the second serial port parameters are the serial port parameters of the physical serial port of the serial port device connected to the serial port gateway.
[0010] In a second aspect, the present application provides a virtual serial port parameter configuration method, which is applied to a serial port gateway, and the method includes:
[0011] In response to the command channel establishment request, a command channel is established; wherein the command channel is set between the serial port gateway and the host computer, and the command channel is used to transmit serial port parameters;
[0012] Acquire the first serial port parameter through the command channel; wherein the first serial port parameter is the serial port parameter of the virtual serial port in the host computer;
[0013] The second serial port parameters are set according to the first serial port parameters; wherein the second serial port parameters are serial port parameters of the physical serial port of the connected serial port device.
[0014] In a third aspect, the present application provides a virtual serial port parameter configuration device, characterized in that the device comprises:
[0015] A virtual serial port management module, used to establish a command channel; wherein the command channel is set between the host computer and the serial port gateway, and the command channel is used to transmit serial port parameters;
[0016] And used to send the first serial port parameter to the serial port gateway through the command channel, so that the serial port gateway sets the second serial port parameter according to the first serial port parameter; wherein the second serial port parameter is the serial port parameter of the physical serial port of the serial port device connected to the serial port gateway;
[0017] Serial port software, for obtaining the first serial port parameter corresponding to the parameter configuration operation in response to the user's parameter configuration operation; wherein the first serial port parameter is the serial port parameter of the virtual serial port in the host computer. In a fourth aspect, the present application provides an electronic device, comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; at least one memory connected to the at least one bus, wherein the processor is configured to: execute the virtual serial port parameter configuration method described in the first aspect of the present application or the virtual serial port parameter configuration method described in the second aspect of the present application.
[0018] In a fifth aspect, the present application further provides a computer storage medium storing computer executable instructions, wherein the computer executable instructions are used to execute the virtual serial port parameter configuration method described in the first aspect of the present application or the virtual serial port parameter configuration method described in the second aspect of the present application.
[0019] The above technical solution provided by the embodiment of the present application has the following advantages over the prior art: the method provided by the embodiment of the present application establishes a command channel between the host computer and the serial port gateway, which is different from the data channel used to transmit data, and the command channel is used to transmit the user's serial port parameter configuration parameters. When the user configures the first serial port parameters on the host computer, the serial port parameters of the virtual serial port are transmitted to the serial port gateway through the command channel, so that the serial port gateway configures the serial port parameters of the physical serial port according to the serial port parameters of the virtual serial port. Through the technical solution provided by the present application, the parameters set by the host computer serial port software for the virtual serial port can be directly applied to the serial port on the serial port gateway. Therefore, the user can complete the configuration of the serial port parameters of the serial port device on the host computer, and there is no need to modify the serial port parameters at the serial port gateway, which effectively improves the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0022] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0023] Figure 1 A flowchart of a virtual serial port parameter configuration method provided for the first method embodiment of the present application.
[0024] Figure 2 A flowchart of a virtual serial port parameter configuration method provided for the second method embodiment of the present application.
[0025] Figure 3 A schematic diagram of the connection of various devices in a virtual serial port parameter configuration method provided in an embodiment of the present application.
[0026] Figure 4 An overall flow chart of a virtual serial port parameter configuration method provided in an embodiment of the present application.
[0027] Figure 5 It is a structural schematic diagram of a virtual serial port parameter configuration device corresponding to the first method embodiment of the present application.
[0028] Figure 6 It is a structural schematic diagram of a virtual serial port parameter configuration device corresponding to the second method embodiment of the present application.
[0029] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0031] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0032] In order to solve the technical problems in the prior art that serial port parameter configuration operations for serial port devices are cumbersome and the user experience is poor, the present application provides a virtual serial port parameter configuration method, which can simplify the serial port parameter configuration operation and effectively improve the user experience when performing serial port parameter configuration.
[0033] Figure 1 A flow chart of a serial port parameter configuration method provided in the first method embodiment of the present application, referring to Figure 1 The first method embodiment of the present application provides a method for configuring serial port parameters, which is applied to a host computer and specifically includes the following steps:
[0034] S11: Establish a command channel; wherein the command channel is set between the host computer and the serial port gateway;
[0035] Specifically, a command channel is established between the host computer and the serial port gateway. The command channel is specifically used to transmit the serial port parameter configuration commands on the host computer, and transmit the serial port parameters configured by the user for the virtual serial port on the host computer to the serial port gateway.
[0036] In a feasible embodiment of the present application, establishing a command channel specifically includes the following steps:
[0037] In response to a command channel establishment operation by a user, generating a command channel establishment request;
[0038] Send a command channel establishment request to the listening port set on the serial port gateway;
[0039] In response to the access permission information returned by the serial port gateway, a command channel is established; wherein the access permission information is information generated by the serial port gateway after successfully authenticating the identity of the host computer according to the command channel establishment request.
[0040] Specifically, the user executes a command channel establishment operation on the host computer; the host computer generates a command channel establishment request after detecting that the user is currently executing a command dynamic establishment operation; the host computer sends the command channel establishment request to the listening port set in the serial port gateway, and waits for the serial port gateway's reply; the serial port gateway receives the command channel establishment request through the listening port; after receiving the command channel establishment request, the serial port gateway authenticates the identity of the request object according to the command channel establishment request; after verifying that the identity of the request object is a legitimate host computer, the serial port gateway generates access permission information and returns the access permission information to the host computer; the host computer completes the establishment of the command channel after receiving the access permission information returned by the serial port gateway.
[0041] It should be noted that the command channel is different from the data channel used for data communication between the host computer and the serial port gateway. The command channel does not transmit business data but only transmits serial port parameters. In some possible embodiments, the command channel and the data channel can be distinguished by the difference in communication protocols between the two.
[0042] When the user performs the command channel establishment operation on the host computer, the communication protocol, transmission parameters, transmission mode and other settings of the command channel will be configured, and the host computer will generate a command channel establishment request based on these configurations.
[0043] After receiving the command channel establishment request, the serial port gateway authenticates the command channel establishment request, authenticates the identity of the current request object, and determines whether the current request object is a legitimate request object recognized by the serial port gateway. Only after passing the identity authentication will the serial port gateway allow the host computer to establish a command channel with itself.
[0044] In some possible implementation scenarios, external illegal objects attempt to establish a command channel with the serial port gateway to illegally configure the serial port gateway. Through authentication when the command channel is established, the security of serial port gateway access is effectively improved.
[0045] In a feasible embodiment of the present application, after sending a command channel establishment request to a listening port set on a serial port gateway, the following steps are also included:
[0046] In response to the access rejection information returned by the serial port gateway, a user prompt information is generated to prompt the user to re-execute the command channel establishment operation; wherein the access rejection information is information generated by the serial port gateway after the identity of the host computer is not successfully authenticated according to the command channel establishment request.
[0047] Specifically, if the serial port gateway successfully authenticates the identity of the host computer based on the current command channel establishment request, on the one hand, the serial port gateway will reject the host computer's command channel establishment request, and on the other hand, the serial port gateway returns a user prompt message to the host computer to remind the user that there is currently illegal external access and prompt the user to re-execute the command channel establishment operation.
[0048] S12: In response to the parameter configuration operation of the user, obtaining first serial port parameters corresponding to the parameter configuration operation; wherein the first serial port parameters are serial port parameters of the virtual serial port in the host computer;
[0049] Specifically, when the user configures the first serial port parameters on the host computer (ie, the serial port parameters of the virtual serial port), the first serial port parameters corresponding to the user's parameter configuration operation are obtained. The first serial port parameters include but are not limited to: baud rate, data bit, check bit, stop bit, etc.
[0050] S13: Sending the first serial port parameter to the serial port gateway through the command channel, so that the serial port gateway sets the second serial port parameter according to the first serial port parameter; wherein the second serial port parameter is the serial port parameter of the physical serial port of the serial port device connected to the serial port gateway.
[0051] Specifically, based on obtaining the first serial port parameters, the first serial port parameters are sent to the serial port gateway through the established command channel. After receiving the first serial port parameters, the serial port gateway configures the second serial port parameters (i.e., the serial port parameters of the serial port device connected to the serial port gateway) according to the first serial port parameters.
[0052] In a feasible embodiment of the present application, sending the first serial port parameter to the serial port gateway through the command channel so that the serial port gateway sets the second serial port parameter according to the first serial port parameter includes:
[0053] Generate a parameter configuration command according to the first serial port parameter;
[0054] The parameter configuration command is sent to the serial port gateway through the command channel, so that the serial port gateway sets the second serial port parameters according to the parameter configuration command.
[0055] Specifically, the host computer generates a parameter configuration command based on the first serial port parameter, and the parameter configuration command is used to instruct the serial port gateway to configure the second serial port parameter. The host computer does not directly send the first serial port parameter to the serial port gateway through the command channel, but generates a parameter configuration command based on the first serial port parameter and sends it to the serial port gateway; after receiving the parameter configuration command, the serial port gateway first parses the parameter configuration command, parses the first serial port parameter currently configured on the host computer from the parameter configuration command, and then configures the second serial port parameter according to the first serial port parameter.
[0056] Through the technical solution provided by the above embodiment, the serial port parameters are important data for the serial port configuration. If the serial port parameters are directly transmitted, there is a possibility of being intercepted during the transmission process. By converting the first serial port parameters into parameter configuration commands,
[0057] Figure 2 A flow chart of a serial port parameter configuration method provided in the second method embodiment of the present application, referring to Figure 2 The second method embodiment of the present application provides a method for configuring serial port parameters, which is applied to a serial port gateway and specifically includes the following steps:
[0058] S21: In response to the command channel establishment request, establish a command channel; wherein the command channel is set between the serial port gateway and the host computer;
[0059] Specifically, after receiving the command channel establishment request sent by the host computer, the serial port gateway establishes the command channel.
[0060] In a feasible embodiment of the present application, before the serial port gateway establishes a command channel with the host computer, it is necessary to authenticate the command channel establishment request. The specific authentication method can be any one of identifying the identity carried in the command channel establishment request, decryption authentication based on encryption algorithm, and identity authentication based on account password. The specific method can be freely set by technical personnel according to the actual implementation scenario, and will not be elaborated here.
[0061] After the serial port gateway completes the establishment of the command channel, it enters the waiting state.
[0062] S22: Obtaining first serial port parameters through the command channel; wherein the first serial port parameters are serial port parameters of the virtual serial port in the host computer;
[0063] Specifically, when the serial port gateway receives the first serial port parameter sent by the host computer through the command channel, it ends the waiting state and obtains the first serial port parameter. The first serial port parameter is the current serial port parameter of the virtual serial port on the host computer, which is also the serial port parameter of the virtual serial port configured according to the user's business needs.
[0064] S23: Setting the second serial port parameters according to the first serial port parameters; wherein the second serial port parameters are serial port parameters of the physical serial port of the connected serial port device;
[0065] Specifically, after receiving the first serial port parameters, the serial port gateway configures the second serial port parameters according to the first serial port parameters, where the second serial port parameters are serial port parameters of the physical serial port of the serial port device connected to the serial port gateway.
[0066] In a feasible embodiment of the present application, in order to improve the security of serial port parameter configuration, the host computer will not directly transmit the first serial port parameter to the serial port gateway, but will convert the first serial port parameter into a parameter configuration command and transmit it to the serial port gateway. At this time, the serial port gateway will first parse the parameter configuration command, and then configure the second serial port parameter after parsing to obtain the first serial port parameter.
[0067] In a feasible embodiment of the present application, in order to ensure the efficiency of serial port parameter configuration and avoid the erroneous first serial port parameter affecting the configuration of the second serial port parameter, when setting the second serial port parameter according to the first serial port parameter, the following steps are also included:
[0068] Verify the validity of the first serial port parameter and determine a verification result; wherein the verification result is a parameter validity result or a parameter invalid result;
[0069] If the verification result is a parameter valid result, setting the second serial port parameters according to the first serial port parameters so that the second serial port parameters are the same as the first serial port parameters;
[0070] When the verification result is an invalid parameter result, invalid parameter information is generated and returned to the host computer.
[0071] Specifically, after receiving the first serial port parameters, the serial port gateway needs to verify the validity of the first serial port parameters. If the verification result is a valid parameter result, it can be explained that the user has correctly configured the first serial port parameters and the transmission process in the command channel has not affected the integrity of the first serial port parameters. At this time, it can be considered that the first serial port parameters obtained are valid, and the second serial port parameters set by the first serial port parameters can ensure the correct connection between the virtual serial port and the physical serial port; if the verification result is an invalid parameter result, it can be explained that the user has incorrectly configured the first serial port parameters or the transmission process in the command channel has affected the integrity of the first serial port parameters, resulting in distortion of the first serial port parameters. At this time, it can be considered that the first serial port parameters obtained are invalid, and invalid parameter information is generated, and the invalid parameter information is returned to the host computer to remind the user to verify the correctness of the first serial port parameters.
[0072] In a feasible embodiment of the present application, after setting the second serial port parameter according to the first serial port parameter, the method further includes:
[0073] Establishing a data channel with the host computer according to the second serial port parameters; wherein the data channel is used for data communication with the host computer;
[0074] The second serial port parameters are returned to the host computer through the data channel.
[0075] Specifically, after completing the setting of the second serial port parameters, the first serial port parameters match the second serial port parameters, and the virtual serial port of the host computer and the physical serial port of the serial port device can effectively communicate data through the established data channel. At this time, the second serial port parameters are returned to the host computer through the established protective gear channel, which is used to verify the smooth flow of the data channel on the one hand, and to feedback the setting results of this setting to the user on the other hand, so that the user can know that the serial port parameter configuration is successfully completed.
[0076] Through the technical solution provided by the present application, a command channel is established between the host computer and the serial port gateway. Different from the data channel used to transmit data, the command channel is used to transmit the user's serial port parameter configuration parameters. When the user configures the first serial port parameter on the host computer, the first serial port parameter is transmitted to the serial port gateway through the command channel, so that the serial port gateway configures the second serial port parameter according to the first command parameter. Through the technical solution provided by the present application, the user can complete the configuration of the serial port parameters of the serial port device on the host computer, and the configuration operation of the serial port parameters of the serial port device effectively improves the user experience.
[0077] Reference Figure 3 In a possible implementation of the present application, a serial port software is provided on the host computer, and the serial port software is used to interact with the user. The user can implement operations such as establishing a command channel, configuring a virtual serial port, configuring a physical serial port, and viewing serial port information on the serial port software. The user creates a virtual serial port of the host computer through the serial port software, and the virtual serial port communicates data with the serial port gateway through the data channel. At the same time, a command channel is also established between the serial port gateway and the host computer for transmitting relevant serial port parameters. The serial port gateway is connected to the serial port device through its own physical serial port and the physical serial port on the serial port device. Through the above connection method, a complete communication link can be established between the host computer-serial port gateway-serial port device, thereby realizing data communication from the host computer to the serial port device.
[0078] Reference Figure 4Based on the above connection scheme, the technical solution provided by this application can be implemented in the following way: a virtual serial port management module and serial port software are set on the host computer, and a serial port parameter parsing module is set in the serial port gateway. Among them, the virtual serial port management module of the serial port software provides a serial port parameter configuration interface for the user; the virtual serial port management module is used to respond to the user's serial port parameter configuration operation and intercept the corresponding serial port parameters; the serial port parameter parsing module is used to parse the intercepted serial port parameters and configure the serial port parameters of the serial port device based on the parsing results.
[0079] The overall process of the technical solution provided by the present application is as follows: first, a listening port is established in the serial port parameter parsing module, and a command channel establishment request initiated by the virtual serial port management module is waited for; after the serial port parameter parsing module obtains the command channel establishment request, a command channel is established; after the command channel is established, the serial port parameter parsing module starts to wait for parameter configuration commands; when the user configures the serial port parameters in the serial port software, the virtual serial port management module intercepts the first serial port parameters and generates a parameter configuration command corresponding to the first serial port parameters; the virtual serial port management module sends the parameter configuration command to the waiting serial port parameter parsing module through the established command channel; after receiving the parameter configuration command, the serial port parameter parsing module parses the parameter configuration command and parses out the first serial port parameters; the serial port parameter parsing module configures the second serial port parameters based on the parsed first serial port parameters; after completing the configuration of the second serial port parameters, the serial port parameter parsing module returns the configuration result to the virtual serial port management module and displays it to the user on the serial port software.
[0080] Reference Figure 5 , corresponding to the first method embodiment described above, the embodiment of the present application provides a virtual serial port parameter configuration device, including:
[0081] The virtual serial port management module 501 is used to establish a command channel; wherein the command channel is set between the host computer and the serial port gateway, and the command channel is used to transmit serial port parameters;
[0082] And used to send the first serial port parameter to the serial port gateway through the command channel, so that the serial port gateway sets the second serial port parameter according to the first serial port parameter; wherein the second serial port parameter is the serial port parameter of the physical serial port of the serial port device connected to the serial port gateway;
[0083] And it is used to respond to the user's parameter configuration operation and obtain the first serial port parameter corresponding to the parameter configuration operation; wherein the first serial port parameter is the serial port parameter of the virtual serial port in the host computer.
[0084] In some possible embodiments of the present application, the virtual serial port management module 501 includes:
[0085] A first generating unit, configured to generate a command channel establishment request in response to a command channel establishment operation of a user;
[0086] A first sending unit, used for sending a command channel establishment request to a listening port set on the serial port gateway;
[0087] The establishing unit is used to establish a command channel in response to the access permission information returned by the serial port gateway; wherein the access permission information is information generated after the serial port gateway successfully authenticates the identity of the host computer according to the command channel establishment request.
[0088] In some possible embodiments of the present application, the virtual serial port management module 501 further includes:
[0089] The second generating unit is used to generate user prompt information in response to the access rejection information returned by the serial port gateway to prompt the user to re-execute the command channel establishment operation; wherein the access rejection information is information generated by the serial port gateway after the identity of the host computer is not successfully authenticated according to the command channel establishment request.
[0090] In some possible embodiments of the present application, the virtual serial port management module 501 further includes:
[0091] A third generating unit, used to generate a parameter configuration command according to the first serial port parameter;
[0092] The second sending unit is used to send the parameter configuration command to the serial port gateway through the command channel, so that the serial port gateway sets the second serial port parameter according to the parameter configuration command.
[0093] Reference Figure 6 , corresponding to the above-mentioned second method embodiment, the embodiment of the present application provides a virtual serial port parameter configuration device, including:
[0094] The serial port parameter parsing module 601 is used to establish a command channel in response to a command channel establishment request; wherein the command channel is set between the serial port gateway and the host computer, and the command channel is used to transmit serial port parameters;
[0095] And used to obtain the first serial port parameters through the command channel; wherein the first serial port parameters are the serial port parameters of the virtual serial port in the host computer;
[0096] And used to set the second serial port parameters according to the first serial port parameters; wherein the second serial port parameters are serial port parameters of the physical serial port of the connected serial port device.
[0097] In some possible embodiments of the present application, the serial port parameter parsing module 601 includes:
[0098] A verification unit, used to verify the validity of the first serial port parameter and determine a verification result; wherein the verification result is a parameter validity result or a parameter invalid result;
[0099] A setting unit, configured to set the second serial port parameters according to the first serial port parameters when the verification result is a parameter valid result, so that the second serial port parameters are the same as the first serial port parameters;
[0100] The fourth generating unit is used to generate parameter invalid information when the verification result is a parameter invalid result, and return the parameter invalid information to the host computer.
[0101] In some possible embodiments of the present application, the device further includes:
[0102] An establishment module is used to establish a data channel with the host computer according to the second serial port parameters; wherein the data channel is used for data communication with the host computer;
[0103] The return module is used to return the second serial port parameters to the host computer through the data channel.
[0104] like Figure 7 As shown, an embodiment of the present application provides an electronic device, including a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704.
[0105] Memory 703, used for storing computer programs;
[0106] In one embodiment of the present application, the processor 701 is used to execute a program stored in the memory 703 to implement a serial port parameter configuration method provided by any of the aforementioned method embodiments, including:
[0107] Establish a command channel; the command channel is set between the host computer and the serial port gateway, and the command channel is used to transmit serial port parameters;
[0108] In response to a parameter configuration operation by a user, obtaining a first serial port parameter corresponding to the parameter configuration operation; wherein the first serial port parameter is a serial port parameter of a virtual serial port in a host computer;
[0109] The first serial port parameter is sent to the serial port gateway through the command channel, so that the serial port gateway sets the second serial port parameter according to the first serial port parameter; wherein the second serial port parameter is the serial port parameter of the physical serial port of the serial port device connected to the serial port gateway.
[0110] or include:
[0111] In response to the command channel establishment request, a command channel is established; wherein the command channel is set between the serial port gateway and the host computer, and the command channel is used to transmit serial port parameters;
[0112] Obtaining the first serial port parameters through the command channel; wherein the first serial port parameters are serial port parameters of the virtual serial port in the host computer;
[0113] The second serial port parameters are set according to the first serial port parameters; wherein the second serial port parameters are serial port parameters of the physical serial port of the connected serial port device.
[0114] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of a serial port parameter configuration method provided in any of the aforementioned method embodiments are implemented.
[0115] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0116] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0117] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0118] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A virtual serial port parameter configuration method, applied to a host computer, characterized in that: The method comprises: Establishing a command channel; wherein the command channel is set between the host computer and the serial port gateway, and the command channel is used to transmit serial port parameters; In response to a parameter configuration operation by a user, obtaining a first serial port parameter corresponding to the parameter configuration operation; wherein the first serial port parameter is a serial port parameter of a virtual serial port in a host computer; Sending the first serial port parameter to the serial port gateway through the command channel, so that the serial port gateway sets the second serial port parameter according to the first serial port parameter; wherein the second serial port parameter is the serial port parameter of the physical serial port of the serial port device connected to the serial port gateway; After sending the first serial port parameter to the serial port gateway through the command channel so that the serial port gateway sets the second serial port parameter according to the first serial port parameter, the method further includes: The second serial port parameter is received through a data channel; wherein the data channel is established by a serial port gateway according to the second serial port parameter, the data channel is used for data communication with a host computer, and the data channel and the command channel are distinguished by different communication protocols.
2. The method according to claim 1, characterized in that Establish a command channel, including: In response to a command channel establishment operation by a user, generating a command channel establishment request; Send the command channel establishment request to the listening port set on the serial port gateway; In response to the access permission information returned by the serial port gateway, the command channel is established; wherein the access permission information is information generated by the serial port gateway after successfully authenticating the identity of the host computer according to the command channel establishment request.
3. The method according to claim 2, characterized in that After sending the command channel establishment request to the listening port set on the serial port gateway, it also includes: In response to the access denial information returned by the serial port gateway, a user prompt information is generated to prompt the user to re-execute the command channel establishment operation; wherein, the access denial information is information generated by the serial port gateway after the identity of the host computer is unsuccessfully authenticated according to the command channel establishment request.
4. The method according to claim 1, characterized in that: The method includes sending the first serial port parameter to the serial port gateway through the command channel so that the serial port gateway sets the second serial port parameter according to the first serial port parameter, including: Generate a parameter configuration command according to the first serial port parameter; The parameter configuration command is sent to the serial port gateway through the command channel, so that the serial port gateway sets the second serial port parameters according to the parameter configuration command.
5. A virtual serial port parameter configuration method, applied to a serial port gateway, characterized in that: The method comprises: In response to the command channel establishment request, a command channel is established; wherein the command channel is set between the serial port gateway and the host computer, and the command channel is used to transmit serial port parameters; Acquire the first serial port parameter through the command channel; wherein the first serial port parameter is the serial port parameter of the virtual serial port in the host computer; Setting the second serial port parameters according to the first serial port parameters; wherein the second serial port parameters are serial port parameters of the physical serial port of the connected serial port device; After the second serial port parameter is set according to the first serial port parameter, the method further includes: Establishing a data channel with the host computer according to the second serial port parameter; wherein the data channel is used for data communication with the host computer, and the data channel and the command channel are distinguished by different communication protocols; The second serial port parameter is returned to the host computer through the data channel.
6. The method according to claim 5, characterized in that Setting the second serial port parameter according to the first serial port parameter includes: Verifying the validity of the first serial port parameter and determining a verification result; wherein the verification result is a parameter valid result or a parameter invalid result; When the verification result is a valid result of the parameters, setting the second serial port parameters according to the first serial port parameters so that the second serial port parameters are the same as the first serial port parameters; When the verification result is the parameter invalid result, parameter invalid information is generated and the parameter invalid information is returned to the host computer.
7. A virtual serial port parameter configuration device, characterized in that: The device comprises: A virtual serial port management module, used to establish a command channel; wherein the command channel is set between the host computer and the serial port gateway, and the command channel is used to transmit serial port parameters; And used to send the first serial port parameter to the serial port gateway through the command channel, so that the serial port gateway sets the second serial port parameter according to the first serial port parameter; wherein the second serial port parameter is the serial port parameter of the physical serial port of the serial port device connected to the serial port gateway; And used to respond to the user's parameter configuration operation, obtain the first serial port parameter corresponding to the parameter configuration operation; wherein the first serial port parameter is the serial port parameter of the virtual serial port in the host computer; And used to receive the second serial port parameters through a data channel; wherein, the data channel is established by a serial port gateway according to the second serial port parameters, the data channel is used to communicate data with a host computer, and the data channel and the command channel are distinguished by different communication protocols.
8. An electronic device, characterized in that: include: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor coupled to the at least one bus; At least one memory connected to the at least one bus, wherein the processor is configured to implement the method of any one of claims 1-4 or the method of any one of claims 5-6.
9. A computer storage medium, characterized in that: Computer executable instructions are stored, and the computer executable instructions are used to execute the method according to any one of claims 1-4 or any one of claims 5-6.
Citation Information
Patent Citations
Method for setting attribute of physical serial port, virtual machine and host machine
CN111796914A
Virtual serial port terminal system, implementation method and equipment thereof and computer storage medium
CN114328349A