Electronic device and serial port management method
By adopting a combination of security measures in electronic devices, including authentication requests and serial port opening commands, combined with the controller's serial port management, the problem of serial ports being easily cracked is solved, achieving improved security and reduced costs.
Patent Information
- Application Number
- CN202211730642.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-12-30
AI Technical Summary
Existing electronic devices with serial ports are easily cracked and attacked through the serial ports, resulting in low security performance.
A combination of multiple security measures is adopted. After the authentication request is passed, a special serial port opening command is required to enable the serial port output function. CPLD is not used, encoding and decoding algorithms are avoided, and a controller such as a CPU is used for serial port management.
It improves the security performance of the serial port, reduces costs, and enhances protection against external attacks by hiding the physical port and the software switch design inside the controller.
Smart Images

Figure CN116049077B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to an electronic device and a serial port management method. Background Art
[0002] Electronic devices often use debugging interfaces such as serial ports and network ports, which facilitate various R&D, debugging, testing, and maintenance. Serial ports are found on most main controllers, such as CPUs and MCUs. These ports can output important device information, and external devices connected to the serial ports of electronic devices can query and control device information with higher permissions.
[0003] Existing electronic devices with serial ports are easily hacked and attacked through the serial ports, resulting in low security performance. Summary of the Invention
[0004] An embodiment of the present application provides an electronic device and a serial port management method. The electronic device adopts a combination of multiple security measures. After passing the authentication request, a special serial port opening command is required to enable the serial port output function, which is safer to use. In addition, CPLD is not used, and there is no need to perform encoding and decoding algorithms on the serial port, which is conducive to reducing costs.
[0005] In a first aspect, an embodiment of the present application provides an electronic device, comprising a controller and a serial port connected to the controller; wherein: the serial port is used to connect to an external device to receive a control command sent by the external device, and send the control command to the controller, the control command including an authentication request and a serial port opening command; the controller is used to receive the serial port opening command after determining that the authentication request is passed, and to open the serial port output function according to the serial port opening command, so that the controller can output device information to the serial port.
[0006] Since the controller can only receive the serial port opening command after determining that the authentication request has passed, and turns on the serial port output function according to the serial port opening command, so as to output the device information to the serial port, that is, after passing the authentication request, a special serial port opening command is required to turn on the serial port output function. In this way, a combination of multiple security measures is adopted, which is safer to use. In addition, CPLD is not used, and there is no need to perform encoding and decoding algorithms on the serial port, which is conducive to reducing costs.
[0007] In one possible implementation, the control command also includes a serial port shutdown command. When the serial port output function is enabled, the controller is further configured to receive the serial port shutdown command and, in response to the serial port shutdown command, disable the serial port output function, thereby prohibiting the controller from outputting the device information to the serial port. This allows the serial port shutdown command to disable the serial port output function, allowing users to customize the serial port shutdown command to reduce the risk of hacking, thereby enhancing the security of the serial port.
[0008] In one possible implementation, the electronic device includes a first output signal line, the controller includes a chip, the chip including a receive pin, a transmit pin, an input pin, and an output pin; the receive pin is used to receive the control command; one end of the first output signal line is connected to the transmit pin, and the other end is connected to the input pin; wherein: the chip is capable of connecting the input pin and the output pin in response to the serial port enable command, thereby enabling the serial port output function, so that the device information is output to the serial port via the transmit pin, the first output signal line, the input pin, and the output pin in sequence; and / or, the chip is capable of disconnecting the input pin and the output pin in response to a serial port disable command sent by the external device, thereby disabling the serial port output function, thereby prohibiting the device information from being output to the serial port via the output pin. In this way, a software switch between IO1 and IO2 can be defined by software within a controller such as a CPU, and the software switch is not connected by default, closing or disconnecting the connection only when conditions are met, thereby improving security and avoiding serial port encoding and decoding algorithms, which helps reduce costs.
[0009] In one possible implementation, the electronic device further includes: a conversion device, communicatively connected to the serial port and the controller; the conversion device is configured to convert the control command into a first signal and transmit the first signal to the controller; the conversion device is further configured to convert the device information into a second signal and transmit the second signal to the serial port. Because the level signal used for data transmission within the electronic device is relatively low, while the level signal of information output or input through the serial port is relatively high, the conversion device can be used to convert the high and low level signals representing the data to enable normal communication between the serial port and the controller.
[0010] In one possible implementation, the electronic device further includes: a first input signal line, one end of which is connected to the output end of the serial port and the other end is connected to the first input end of the conversion device; a second input signal line, one end of which is connected to the first output end of the conversion device and the other end is connected to a receiving pin of the controller; and / or a second output signal line, one end of which is connected to the output pin of the controller and the other end is connected to the second input end of the conversion device; and a third output signal line, one end of which is connected to the second output end of the conversion device and the other end is connected to the input end of the serial port. In this way, the input signal and the output signal communicate using different channels without interference.
[0011] In one possible implementation, the electronic device further includes a circuit board, the controller, the conversion device, and the serial port being disposed on the circuit board; and at least one of the first input signal line, the second input signal line, the first output signal line, the second output signal line, and the third output signal line being located on an inner layer of the circuit board. Thus, external interface signals are routed along the inner layer signal lines of the PCB. Even if the housing of the electronic device is disassembled, it is impossible to easily analyze the signal definitions and the connection relationships between the signals and internal functional components such as the main controller, the conversion device, and the serial port.
[0012] In a possible implementation, the serial port includes at least one of an RS232 interface, an RJ45 connector, and an audio connector.
[0013] In a second aspect, an embodiment of the present application provides a serial port management method, which is applied to an electronic device having a serial port, the serial port management method comprising: receiving an authentication request sent by an external device through the serial port; receiving a serial port opening command through the serial port when it is determined that the authentication request is passed; and opening a serial port output function according to the serial port opening command so as to output device information to the serial port.
[0014] In one possible implementation, the serial port management method further includes: when the serial port output function is turned on, receiving a serial port close command sent by the external device through the serial port; and closing the serial port output function according to the serial port close command to prohibit the device information from being output to the serial port.
[0015] In a possible implementation, the serial port management method further includes: when it is determined that the authentication request has not been passed, keeping the serial port output function disabled.
[0016] In a third aspect, an embodiment of the present application provides a serial port management device, which includes: a receiving module for receiving an authentication request sent by an external device through a serial port; the receiving module is also used to receive a serial port opening command through the serial port when it is determined that the authentication request is passed; and a control module for opening a serial port output function according to the serial port opening command so as to output device information to the serial port.
[0017] In one possible implementation, the receiving module is further used to receive a serial port close command sent by the external device through the serial port when the serial port output function is turned on; the control module is further used to turn off the serial port output function according to the serial port close command to prohibit the device information from being output to the serial port.
[0018] In a possible implementation, the control module is further configured to keep the serial port output function disabled when it is determined that the authentication request has not been passed.
[0019] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to execute the method provided in the second aspect above when calling the computer program.
[0020] In a fifth aspect, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium stores instructions. When the instructions are executed on a computer, the computer executes the method provided in the second aspect above.
[0021] In a sixth aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the method provided in the second aspect above.
[0022] Other features and advantages of the present invention will be described in detail in the following specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The following is a brief introduction to the drawings required for describing the embodiments or prior art.
[0024] Figure 1 It is a structural diagram of an electronic device with a serial port;
[0025] Figure 2 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0026] Figure 3 A specific process diagram of a serial port management method provided in an embodiment of the present application;
[0027] Figure 4 A flowchart of a serial port management method provided in an embodiment of the present application;
[0028] Figure 5 A schematic diagram of the structure of a serial port management device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of this specification, rather than all the embodiments.
[0030] In the description of this specification, "one embodiment" or "some embodiments" means that one or more embodiments of this specification include a particular feature, structure, or characteristic described in conjunction with the embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in other embodiments," etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized.
[0031] In the description of this specification, unless otherwise specified, " / " means or. For example, A / B can mean A or B. "And / or" in this document is simply a description of the association relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of this application, "plurality" means two or more than two.
[0032] In addition, in the description of this specification, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly specifying the number of the technical features indicated. Therefore, a feature specified as "first" or "second" may explicitly or implicitly include one or more of the features. The terms "including," "comprising," "having," and their variations all mean "including but not limited to," unless otherwise specifically emphasized.
[0033] A serial port, also known as a "serial port" or a serial communication interface (commonly referred to as a COM port), is an expansion interface that uses serial communication. Existing electronic devices with serial ports are vulnerable to hacking attacks, resulting in low security.
[0034] Figure 1 Figure 1 is a schematic diagram of the structure of an electronic device with a serial port. Figure 1As shown, an external complex programmable logic device (CPLD) is used to perform RX input detection on the UART (universal asynchronous receiver / transmitter) level output by the external 232 serial port conversion chip. If it is consistent with the encoding password set by the CPLD, the CPLD will take action to keep the serial port open, and the central processing unit (CPU) will then issue the corresponding serial port output. That is, the CPU sends the data to the CPLD, which then encodes it once and outputs it to the corresponding serial port. Then, the content output from the serial port needs to be decoded by the developer according to the ciphertext, that is, the serial port input is encoded and decoded to achieve encryption, thereby achieving the protection purpose by changing the serial port data format.
[0035] This approach uses an external intelligent device, the CPLD, to perform input detection and password comparison, adding only one layer of serial port protection. However, this increases the physical cost of the CPLD. Furthermore, the code output via the 232 serial port requires specialized decoding, making it difficult to use in field maintenance applications.
[0036] In view of this, an embodiment of the present application provides an electronic device and a serial port management method. The electronic device adopts a combination of multiple security measures. After passing the authentication request, a special serial port opening command is required to enable the serial port output function, which is safer to use. That is, the default shutdown action is performed on the external non-essential interface, and it must be enabled after a successful login to prevent attackers from analyzing and attacking the signal. In addition, CPLD is not used, and serial port encoding and decoding algorithms are not required, which is conducive to reducing costs. In addition, the password of the authentication request can be modified and reset through a controller such as a CPU, increasing management security.
[0037] Figure 2 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 2 As shown, the electronic device includes a controller 1 and a serial port 2 connected to the controller 1. Serial port 2 is used to connect to an external device to receive control commands from the external device and send these control commands to the controller 1. The control commands include authentication requests and serial port enable commands. After determining that the authentication request has passed, the controller 1 receives the serial port enable command and, based on the serial port enable command, enables the serial port output function, allowing the controller 1 to output device information to the serial port 2.
[0038] Among them, the device information can be information related to the device obtained by the controller 1. When the controller 1, such as a CPU, is set on a circuit board to be introduced below, the device information also includes information obtained by the CPU from the circuit board. Exemplarily, the device information may include at least one of hardware information, control information, device status information, and the like. The authentication request may include a username and password. That is, the controller 1, such as a central processing unit (CPU) or a microcontroller unit (MCU), itself enables the serial port password login function. Only after entering the correct username and password can the device be logged in through the serial port, and further commands can be input to the CPU, such as enabling the serial port output function. In addition, the username and password can be modified through the controller 1, which can improve management security. That is, the user can modify and reset the password to avoid the problem of an attacker obtaining the initial password and then attacking the device, thereby enhancing the security protection of the serial port.
[0039] Since the controller can only receive the serial port opening command after determining that the authentication request has passed, and opens the serial port output function according to the serial port opening command, so as to output the device information to the serial port, that is, after logging in through the authentication request, a special serial port opening command is required to open the serial port output function. In this way, a combination of multiple security measures is adopted, which is safer to use. In addition, CPLD is not used, and there is no need to perform encoding and decoding algorithms on the serial port, which is conducive to reducing costs.
[0040] In addition, the control command may also include a serial port close command. When the serial port output function is turned on, the controller 1 is also used to receive the serial port close command and turn off the serial port output function according to the serial port close command to prohibit the controller 1 from outputting device information to the serial port 2.
[0041] Furthermore, serial port 2 may include at least one of an RS232 interface, an RJ45 connector, and an audio connector. RS232 interfaces typically come in 9-pin (DB-9) or 25-pin (DB-25) configurations. Using a standard serial port, such as a DB9, increases the risk of serial port hacking due to its exposed nature and fixed wiring.
[0042] For most electronic devices, some customers do not need to use a physical external serial port. For them, the external physical serial port is an optional interface. If this interface is added and exposed, there will be uncontrollable risks such as information security leakage, which to a certain extent provides convenience for third-party attackers to use this interface to carry out corresponding cracking attacks.
[0043] The solution of the embodiment of the present application may adopt non-standard interfaces such as RJ45, audio JACK connector or other general IO plug-ins, so that signal recognition cannot be performed based on the appearance of the serial port, thereby achieving the purpose of hiding the external physical serial port to a certain extent, increasing the difficulty of successful attack, reducing the risk of attackers attacking through the serial port, and achieving the purpose of enhancing the physical security of the serial port.
[0044] Continue to refer Figure 2 The electronic device may include a first output signal line L1, the controller 1 includes a chip, the chip includes a receiving pin RX, a transmitting pin TX, an input pin IO1 and an output pin IO2; the receiving pin RX is used to receive a control command; one end of the first output signal line L1 is connected to the transmitting pin TX, and the other end is connected to the input pin IO1.
[0045] The chip can connect input pin IO1 and output pin IO2 in response to a serial port enable command, enabling the serial port output function. This allows device information to be output to serial port 2 via transmit pin TX, first output signal line L1, input pin IO1, and output pin IO2 in sequence. Furthermore, the chip can disconnect input pin IO1 and output pin IO2 in response to a serial port disable command sent by an external device, disabling the serial port output function and prohibiting device information from being output to serial port 2 via output pin IO2.
[0046] Because the functions of the receive pin RX and the transmit pin TX are generally fixed and difficult to modify, the transmit pin TX can be connected to the input pin IO1 via the first output signal line L1. This allows the input pin IO1 and the output pin IO2 to communicate in accordance with a control command, thereby enabling the serial port output function. The input pin IO1 and the output pin IO2 can also be disconnected in accordance with a control command to disable the serial port output function. In other words, the TX output signal of the serial port of a controller such as a CPU or MCU is not directly output externally. Instead, it is first input to its own input pin IO1. Once the external RX input account and password are correct and authorization is enabled, thus enabling the serial port output function, it is then output through the output pin IO2, achieving controllable display output of the serial port TX.
[0047] In addition, the electronic device may further include a conversion device 3, which is communicatively connected to the serial port 2 and the controller 1 respectively; the conversion device 3 is used to convert a control command into a first signal and send it to the controller 1; the conversion device 3 is also used to convert device information into a second signal and send it to the serial port 2. The conversion device 3 can be, for example, a conversion chip.
[0048] Taking the controller 1 as a CPU and the conversion device 3 as an RS232 chip as an example, the UART output signal TX in the CPU's UART connection is not directly connected to the RS232 chip or external device, but is connected to its own IO1 as input, and IO2 is connected to the RS232 chip as the output of the serial port. In addition, inside the CPU, the software defines that there is a software switch between IO1 and IO2. By default, IO1 and IO2 are not connected, that is, the software switch is disconnected, and the connection is closed or disconnected only when the conditions are met.
[0049] That is, by default, IO1 and IO2 remain disconnected within the CPU, and the serial port does not output any information. Then, a developer-defined serial port enable command, or serial port open command, is entered. After the CPU responds to this command, the TX signal of its serial port UART returns to IO1, and software is connected within the CPU. This allows external output via the IO2 pin, enabling full serial port functionality and normal display operation. Furthermore, entering a serial port close command disconnects the UART TX signal, shutting down the serial port output and thus protecting the serial port. Users can also enhance serial port security by resetting the CPU password, preventing attackers from gaining access to the initial password and launching attacks on the device.
[0050] like Figure 2 As shown, in order to enable the serial port 2 to send control commands to the controller 1 through the conversion device 3, the electronic device may further include a first input signal line M1 and a second input signal line M2. One end of the first input signal line M1 is connected to the output end of the serial port 2, and the other end is connected to the first input end of the conversion device 3. One end of the second input signal line M2 is connected to the first output end of the conversion device 3, and the other end is connected to the receive pin RX of the controller 1.
[0051] To enable the controller 1 to send control commands to the serial port 2 via the conversion device 3, the electronic device may further include a second output signal line L2 and a third output signal line L3. One end of the second output signal line L2 is connected to the output pin IO2, and the other end of the second output signal line L2 is connected to the second input terminal of the conversion device 3. One end of the third output signal line L3 is connected to the second output terminal of the conversion device 3, and the other end is connected to the input terminal of the serial port 2.
[0052] Furthermore, the electronic device may also include a circuit board (not shown in the figure). The controller 1, the conversion device 3, and the serial port 2 are arranged on the circuit board. In addition, at least one of the first input signal line M1, the second input signal line M2, the first output signal line L1, the second output signal line L2, and the third output signal line L3 is located on the inner layer of the circuit board. In some examples, the first input signal line M1, the second input signal line M2, the first output signal line L1, the second output signal line L2, and the third output signal line L3 are all located on the inner layer of the circuit board. In this way, the external interface signal is routed along the inner layer signal line of the PCB. Even if the casing is disassembled, it is impossible to simply analyze the definition of the signal and the connection relationship with the internal functional IC device, thereby hiding the connection ends of the controller 1, the conversion device 3, and the serial port 2, further improving security protection and reducing the probability of an attacker correctly judging the physical interface.
[0053] The electronic device of the present invention does not utilize a CPLD or external encryption algorithm, thus saving costs and enabling the controller, such as a CPU or MCU, to implement serial port output protection. Furthermore, a universal IO connector or the like can be used to display the serial port externally, achieving a certain degree of concealment of the physical port. This prevents signal identification from the outside, reducing the possibility of attacks through the serial port. Furthermore, the serial port output is disabled by default, enhancing serial port security.
[0054] Figure 3 This is a specific process diagram of a serial port management method provided in an embodiment of the present application. Figure 3 As shown, the serial port TX is disconnected by default; after the external device is connected to the serial port, you can first enter the user name through the external device, and then enter the password; if the password is incorrect, you need to re-enter the user name; if the password is correct, you can enter the serial port opening command; if the serial port opening command is incorrect, the serial port TX output will not be displayed. If the serial port opening command is correct, the serial port TX can output normally; then, you can enter the serial port closing command. If the serial port closing command is correct, the serial port output will not be displayed. If the serial port closing command is incorrect, the serial port TX can output normally.
[0055] Next, based on the specific process diagram of the serial port management method described above, a serial port management method provided by an embodiment of the present application is introduced. It can be understood that this method is another way of expressing the specific process diagram of the serial port management method described above, and the two are combined. This method is proposed based on the specific process diagram of the serial port management method described above. Part or all of the content of this method can be found in the description of the specific process diagram of the serial port management method above.
[0056] Figure 4This is a flow chart of a serial port management method provided in an embodiment of the present application. The serial port management method can be applied to an electronic device having a serial port 2, and for example, can be applied to a controller of the electronic device such as a CPU or MCU. Figure 4 As shown, the serial port management method includes the following steps:
[0057] S401: Receive an authentication request sent by an external device through a serial port.
[0058] The authentication request may include a user name and a password, and the user name and password can be modified through the controller.
[0059] S402: Receive a serial port opening command through the serial port when it is determined that the authentication request is passed.
[0060] In addition, if it is determined that the authentication request has not been passed, the serial port output function may be kept closed.
[0061] S403: Enable the serial port output function according to the serial port enable command, so as to output the device information to the serial port.
[0062] S404: When the serial port output function is enabled, a serial port close command sent by an external device is received through the serial port.
[0063] S405: Disable the serial port output function according to the serial port close command to prohibit outputting device information to the serial port.
[0064] It is understandable that part or all of the description in the above method can refer to the relevant description of the electronic device above, and will not be repeated here.
[0065] Since the controller can only receive the serial port opening command after determining that the authentication request has passed, and turns on the serial port output function according to the serial port opening command, so as to output the device information to the serial port, that is, after passing the authentication request, a special serial port opening command is required to turn on the serial port output function. In this way, a combination of multiple security measures is adopted, which is safer to use. In addition, CPLD is not used, and there is no need to perform encoding and decoding algorithms on the serial port, which is conducive to reducing costs.
[0066] Based on the method in the above embodiment, an embodiment of the present application provides a serial port management device. Figure 5 This is a structural diagram of a serial port management device provided in an embodiment of the present application. Figure 5 As shown, the serial port management device 500 includes a receiving module 501 and a control module 502. The receiving module 501 is configured to receive an authentication request sent by an external device via a serial port. The receiving module 501 is further configured to receive a serial port enable command via the serial port if the authentication request is approved. The control module 502 is configured to enable the serial port output function in response to the serial port enable command, thereby outputting device information to the serial port.
[0067] Furthermore, the receiving module 501 can also be used to receive a serial port close command sent by an external device through the serial port when the serial port output function is turned on. The control module 502 can also be used to turn off the serial port output function according to the serial port close command to prohibit the device information from being output to the serial port.
[0068] In addition, the control module 502 may also be configured to keep the serial port output function disabled when it is determined that the authentication request has not been passed.
[0069] It should be understood that the above-mentioned device is used to execute the method in the above-mentioned embodiment. The implementation principle and technical effect of the corresponding program module in the device are similar to those described in the above-mentioned method. The working process of the device can refer to the corresponding process in the above-mentioned method and will not be repeated here.
[0070] Based on the method in the above embodiment, an embodiment of the present application further provides an electronic device, which includes a memory and a processor, the memory being used to store a computer program; and the processor being used to execute the above serial port management method when calling the computer program.
[0071] In summary, the embodiments of the present application propose a simple secure serial port design scheme that combines multiple security measures. This scheme, without incurring additional costs, can prevent attackers from performing long-term password analysis on the physical serial port, disrupting the normal use of the device, or stealing key information. For example, it can be applied to various electronic devices that use controllers such as CPUs or MCUs, especially those that strongly rely on serial port debugging but do not require serial port functionality by the product customer. It is also suitable for physical devices in non-secure locations where no one is effectively supervising them.
[0072] Specifically, when logging into the serial port, an external device needs to be connected to the serial port via a serial port cable, and the initial account and password must be entered in the display window of the external device so that the controller, such as the CPU, can perform user authentication processing. Only after entering the correct user name and password can other operations be performed, for example, entering a serial port opening command to turn on the serial port output function, that is, the serial port output of a controller such as a CPU also requires a special operation command before it can issue external signal outputs, otherwise other personnel will not be able to perform signal testing and cracking analysis on external IO devices or interfaces. Furthermore, after completing the serial port application, the serial port can be closed again without affecting the normal operation of the function. In this way, the serial port can be authenticated for input and shut down for output based on the serial port master control device itself, such as the CPU or MCU, which is simple to implement and does not increase the cost of additional physical equipment.
[0073] In addition, the standard serial port generally uses a DB9 interface output, which increases the exposure of the serial port. The solution of the embodiment of the present application can adopt various types of serial ports. For example, RJ45, audio JACK connector or other general IO connectors can be used to realize the external display of the serial port. In this way, the external physical interface form is effectively hidden, and the purpose of physical hiding of the serial port is achieved to a certain extent, so that attackers cannot identify what kind of signal and signal definition the physical interface is through appearance.
[0074] It is understood that the processor in the embodiments of the present application may be a central processing unit (CPU), or may be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
[0075] The method steps in the embodiments of the present application can be implemented by hardware or by a processor executing software instructions. The software instructions can be composed of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, mobile hard disks, CD-ROMs or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.
[0076] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted via the computer-readable storage medium. The computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state drive (SSD)).
[0077] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts that are not described or recorded in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. It should be understood that the size of the sequence numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention. In addition, the various numerical numbers involved in the embodiments of the present application are only for the convenience of description and are not used to limit the scope of the embodiments of the present application.
[0078] The basic principles of this application have been described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, and effects mentioned in this application are merely illustrative and not restrictive, and should not be considered as necessarily possessed by each embodiment of this disclosure. Furthermore, the specific details disclosed above are provided for illustrative purposes and to facilitate understanding, rather than as limitations. These details do not limit this disclosure to requiring the use of these specific details.
Claims
1. An electronic device, characterized in that: It comprises a controller (1) and a serial port (2) connected to the controller (1); wherein: The serial port (2) is used to connect to an external device to receive a control command sent by the external device, and to send the control command to the controller (1), wherein the control command includes an authentication request and a serial port opening command; the control command also includes a serial port closing command, and when the serial port output function is turned on, the controller (1) is also used to receive the serial port closing command and turn off the serial port output function according to the serial port closing command, so as to prohibit the controller (1) from outputting device information to the serial port (2); The controller (1) is configured to receive the serial port opening command after determining that the authentication request is passed, and to open the serial port output function according to the serial port opening command, so that the controller (1) can output device information to the serial port (2); The electronic device comprises a first output signal line (L1), the controller (1) comprises a chip, the chip comprises a receiving pin (RX), a transmitting pin (TX), an input pin (IO1) and an output pin (IO2); the receiving pin (RX) is used to receive the control command; one end of the first output signal line (L1) is connected to the transmitting pin (TX), and the other end is connected to the input pin (IO1); wherein: The chip can connect the input pin (IO1) and the output pin (IO2) according to the serial port opening command to realize opening the serial port output function, so that the device information is output to the serial port (2) in sequence through the sending pin (TX), the first output signal line (L1), the input pin (IO1) and the output pin (IO2); and / or, The chip can disconnect the input pin (IO1) and the output pin (IO2) according to a serial port closing command sent by the external device, thereby closing the serial port output function and prohibiting the device information from being output to the serial port (2) through the output pin (IO2).
2. The electronic device according to claim 1, wherein The electronic device further comprises: A conversion device (3) is communicatively connected to the serial port (2) and the controller (1) respectively; the conversion device (3) is used to convert the control command into a first signal and then send it to the controller (1); the conversion device (3) is also used to convert the device information into a second signal and then send it to the serial port (2).
3. The electronic device according to claim 2, wherein: The electronic device further comprises: a first input signal line (M1), one end of the first input signal line (M1) being connected to the output end of the serial port (2), and the other end being connected to the first input end of the conversion device (3); a second input signal line (M2), one end of the second input signal line (M2) being connected to the first output end of the conversion device (3), and the other end being connected to the receiving pin (RX) of the controller (1); and / or, a second output signal line (L2), one end of the second output signal line (L2) being connected to the output pin (IO2) of the controller (1), and the other end of the second output signal line (L2) being connected to the second input end of the conversion device (3); A third output signal line (L3), one end of the third output signal line (L3) is connected to the second output end of the conversion device (3), and the other end is connected to the input end of the serial port (2).
4. The electronic device according to claim 3, wherein: The electronic device further comprises: A circuit board, the controller (1), the conversion device (3) and the serial port (2) are arranged on the circuit board; Furthermore, at least one of the first input signal line (M1), the second input signal line (M2), the first output signal line (L1), the second output signal line (L2) and the third output signal line (L3) is located on an inner layer of the circuit board.
5. The electronic device according to any one of claims 1 to 4, characterized in that: The serial port (2) includes at least one of an RS232 interface, an RJ45 connector, and an audio connector.
6. A serial port management method, applied to the electronic device according to claim 1, characterized in that: include: receiving an authentication request sent by an external device through the serial port; When it is determined that the authentication request is passed, receiving a serial port opening command through the serial port; Enable the serial port output function according to the serial port enable command, so as to output the device information to the serial port; The serial port management method further includes: when the serial port output function is enabled, receiving a serial port close command sent by the external device through the serial port; The serial port output function is disabled according to the serial port close command to prohibit the device information from being output to the serial port.
Citation Information
Patent Citations
Equipment debugging method and electronic equipment
CN113535494A
Wireless terminal and interface access authentication method of wireless terminal in Uboot mode
CN114189862A