Serial port log recording method and device and computer equipment

By establishing a link between the target serial port and the second serial controller, a copy of the serial port log information is obtained and stored, which solves the problem of missing logs during remote device login, ensures the integrity of log information, and supports anomaly location and recovery.

CN122285579APending Publication Date: 2026-06-26HUAWEI TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUAWEI TECH CO LTD
Filing Date
2024-12-25
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

When a remote device logs in via a serial port, the target serial port's log information cannot be recorded, resulting in missing logs and affecting anomaly location and recovery.

Method used

The link between the target serial port and the original first serial controller is disconnected, and a link with the second serial controller is established. The second serial controller is used to obtain and store a copy of the serial port log information to ensure the integrity of the log information.

Benefits of technology

It enables complete recording of target serial port log information during remote device access, supporting anomaly location and recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122285579A_ABST
    Figure CN122285579A_ABST
Patent Text Reader

Abstract

This application discloses a serial port logging method, apparatus, and computer device, relating to the field of computer technology. In this application, after disconnecting the first serial link between the target serial port of the target serial port device and the original first serial controller, and establishing a second serial link between the target serial port and the second serial controller, the target serial port device will communicate with the remote device through the second serial link. That is, the serial port log information output by the target serial port will be transmitted to the second serial controller through the second serial link, and then output to the remote device. In this case, a copy of the serial port log information transmitted on the second serial link can be obtained, and this copy of the serial port log information can be stored as the serial port log information of the target serial port. This achieves the recording of the serial port log information of the target serial port during the remote device's access to the target serial port, ensuring the integrity of the serial port log information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a serial port log recording method, apparatus and computer equipment. Background Technology

[0002] The baseboard management controller (BMC) in computer equipment typically contains multiple serial controllers. Each serial controller can establish a serial link with the serial port of a serial device on the computer equipment, such as a hard disk controller or a central processing unit (CPU). Through this serial link, the serial controller can receive and record serial port log information output from the connected serial port device. This allows for the analysis of the recorded serial port log information to pinpoint the source of any system anomalies or malfunctions.

[0003] Currently, BMCs are generally equipped with Serial Over LAN (SOL) functionality. SOL functionality refers to using the Intelligent Platform Management Interface (IPMI) protocol to redirect the traffic of a target serial port device from its original connected serial controller to a designated serial controller, and then outputting it to the remote device through the SOL connection between the designated serial controller and the remote device. In this case, because the traffic of the target serial port is redirected to the designated serial controller and then output to the remote device, the original serial controller connected to the target serial port will no longer receive serial port log information output from that target serial port. Therefore, logging is no longer possible, resulting in missing logs during remote device login. Summary of the Invention

[0004] This application provides a serial port logging method, apparatus, and computer device, which can log the serial port of a serial port device during the period when a remote device accesses the serial port device through a SOL connection, ensuring the integrity of the serial port log information.

[0005] To achieve the above objectives, this application adopts the following technical solution:

[0006] In a first aspect, a serial port logging method is provided, the method comprising: in response to a serial port access command, disconnecting a first serial link between a target serial port of a target serial port device in a computer device and a first serial controller on a BMC, and establishing a second serial link between the target serial port and a second serial controller, the second serial controller being a serial controller used by a remote device to log in to the computer device; obtaining a copy of the serial port log information transmitted through the second serial link, and storing the copy of the serial port log information.

[0007] This application can be implemented using a digital integrated circuit in a computer device. For example, the digital integrated circuit can be a complex programmable logic device (CPLD). In one possible implementation, the serial port of a serial device can be connected to a serial controller on a BMC via the digital integrated circuit.

[0008] In this application, after disconnecting the first serial link between the target serial port of the target serial port device and the original first serial controller, and establishing a second serial link between the target serial port and the second serial controller, the target serial port device will communicate with the remote device through the second serial link. That is, the serial port log information output by the target serial port will be transmitted to the second serial controller through the second serial link, and then output to the remote device. In this case, obtaining and storing a copy of the serial port log information transmitted on the second serial link realizes the recording of the serial port log information output by the target serial port during the remote device's access to the target serial port device, ensuring the integrity of the serial port log information.

[0009] Optionally, the process of obtaining a copy of the serial port log information transmitted through the second serial link may include: copying the serial port log information sent by the target serial port device to the second serial controller through the second serial link to obtain a copy of the serial port log information.

[0010] In this application, during communication between the target serial port device and the second serial controller, the serial port log information of the target serial port is transmitted through the second serial link. Based on this, the serial port log information transmitted on the second serial link is copied to obtain a copy of the serial port log information and store it. In this way, neither the communication between the remote device and the target serial port device is affected, nor is the recording of the serial port log information affected.

[0011] Furthermore, considering that the information sent by the remote device to the target serial port via the second serial link may involve user privacy information, this application omits the copying and recording of the information sent by the remote device to the target serial port via the second serial link. That is, the information to be received by the target serial port is not copied or recorded, thereby protecting user privacy and improving security.

[0012] Optionally, the first serial controller is a controller for recording serial port log information output by the target serial port, and the process of storing a copy of the serial port log information may include: sending a copy of the serial port log information to the first serial controller for storage.

[0013] In this application, the first serial controller is a controller allocated on the BMC for the target serial port to communicate with the target serial port, and has the function of recording the serial port log information of the target serial port. Based on this, after obtaining the serial port log information of the target serial port, the serial port log information can be sent to the first serial controller for recording.

[0014] Optionally, the target serial port device can be any one of a CPU, a device controller, and the BMC. The device controller can refer to a controller of a peripheral component of a computer device; for example, the device controller can be a hard disk controller.

[0015] Optionally, a serial port device on a computer device may have one serial port or multiple serial ports. When a serial port device has multiple serial ports, these ports can be assigned to different functional units associated with the device. These functional units can be hardware units, such as those included on the serial port device itself, or hardware units that communicate with the serial port device. Alternatively, the functional units associated with the serial port device can also be software units, such as software units running on the serial port device.

[0016] For example, when the target serial port device is a CPU, the CPU has multiple serial ports, including the serial port corresponding to the computer device's operating system, the serial port corresponding to the basic input / output system, and the serial port corresponding to the inertial measurement unit (IMU), etc. Therefore, the target serial port can be any one of the multiple serial ports.

[0017] In a second aspect, a serial port logging device is provided, the serial port logging device comprising at least one module, the at least one module being used to execute the serial port logging method described in the first aspect above.

[0018] For example, the at least one module may include a link switching module, a serial port log acquisition module, and a serial port log storage module.

[0019] The link switching module is used to disconnect the first serial link between the target serial port of the target serial port device in the computer device and the first serial controller on the baseboard management controller (BMC) in response to a serial port access command, and establish a second serial link between the target serial port and the second serial controller, wherein the second serial controller is the serial controller used by the remote device to log in to the computer device; the serial port log acquisition module is used to acquire a copy of the serial port log information transmitted through the second serial link; and the serial port log storage module is used to store a copy of the serial port log information.

[0020] Optionally, the serial port log acquisition module is specifically used to: copy the serial port log information sent by the target serial port device to the second serial controller through the second serial link, and obtain a copy of the serial port log information.

[0021] Optionally, the first serial controller is a controller for recording serial port log information output by the target serial port, and the serial port log storage module is specifically used to: send a copy of the serial port log information to the first serial controller for storage.

[0022] Optionally, the target serial port device is any one of a central processing unit (CPU), a device controller, and the BMC.

[0023] Optionally, if the target serial port device is a CPU, the target serial port is the serial port corresponding to the operating system of the computer device, or the target serial port is the serial port corresponding to the IMU.

[0024] Thirdly, a computer device is provided, the computer device including a CPLD, a BMC and a target serial port device, the BMC including a first serial controller and a second serial controller, the target serial port device being connected to the first serial controller or the second serial controller through the CPLD, the CPLD being used to execute at least one program instruction or code stored in a memory to implement the serial port logging method described in the first aspect above.

[0025] Optionally, the target serial port device is any one of a central processing unit (CPU), a device controller, and the BMC.

[0026] Optionally, if the target serial port device is a CPU, the target serial port is the serial port corresponding to the operating system of the computer device, or the target serial port is the serial port corresponding to the IMU.

[0027] Optionally, the computer device further includes the memory.

[0028] Fourthly, a computer-readable storage medium is provided, wherein instructions are stored therein, which, when executed on a computer device, cause the computer device to perform the serial port logging method described in the first aspect.

[0029] Fifthly, a computer program product containing instructions is provided, which, when run on a computer device, causes the computer device to execute the serial port logging method described in the first aspect.

[0030] The technical effects achieved by the second to fifth aspects mentioned above are similar to those achieved by the corresponding technical means in the first aspect, and will not be repeated here. Attached Figure Description

[0031] Figure 1 A schematic diagram of the structure of a computer device used in the serial port logging method provided in the embodiments of this application;

[0032] Figure 2 A flowchart illustrating a serial port logging method provided in this application embodiment;

[0033] Figure 3 A schematic diagram illustrating serial link switching of a CPLD provided in an embodiment of this application;

[0034] Figure 4 This is a schematic diagram illustrating how a CPLD acquires and stores a copy of serial port log information, as provided in an embodiment of this application.

[0035] Figure 5 This is a schematic diagram of the structure of a serial port log recording device provided in an embodiment of this application. Detailed Implementation

[0036] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0037] Before providing a detailed explanation of the embodiments of this application, let's first introduce the application scenarios involved in the embodiments of this application.

[0038] Computer devices generate various information during startup and operation, such as kernel startup logs, system status and error messages, and application runtime information. This information can be used to quickly locate system anomalies or faults.

[0039] Currently, the BMC (Browser Control Center) in computer equipment typically has multiple serial controllers. Each serial controller can establish a serial link with the serial port of a serial device on the computer equipment, such as a hard disk controller or a central processing unit (CPU). Based on this, the serial device can output the aforementioned information to the corresponding serial controller through this serial link, and the serial controller records this information. This information output through the serial port of the serial device can be called serial port log information, or simply serial port information.

[0040] Currently, most BMCs are equipped with SOL (Serial Log) functionality. In certain scenarios, such as when a user needs to configure or operate a computer's operating system remotely, or when a user needs to read certain hardware and software operating information from a computer, the user can utilize the SOL function to control a remote device to remotely log in to the computer via a specified serial controller. Subsequently, the user can control the remote device to communicate with a target serial port on a specific serial port device through the specified serial controller, thereby controlling that serial port device. It should be noted that during remote operation of the serial port device, the user's actions may adversely affect the normal operation of the computer, for example, causing malfunctions. Therefore, to better locate and recover from these anomalies, it is crucial to record the serial port log information of the target serial port during communication between the remote device and the target serial port.

[0041] However, currently, when a remote device communicates with the target serial port, the link between the target serial port and the originally connected serial controller is broken, and a serial link is established between the target serial port and the serial port of the designated serial controller. Thus, the traffic of the target serial port is redirected to the designated serial controller and output to the remote device via the local area network. In this situation, the serial controller originally connected to the target serial port can no longer receive the serial port log information output by the target serial port, and therefore cannot record the target serial port's serial port log information. The designated serial controller, used for remote login, does not have logging capabilities and cannot record the target serial port's serial port log information either. Therefore, during the process of a remote device logging into the computer and accessing the target serial port, the computer cannot record the serial port log information output by the target serial port, resulting in a lack of serial port log information for the target serial port. This will hinder subsequent anomaly location and recovery.

[0042] Based on this, this application provides a serial port log recording method. In this method, after disconnecting the first serial link between the target serial port of the target serial port device and the original first serial controller, and establishing a second serial link between the target serial port and the second serial controller, the target serial port device will communicate with the remote device through the second serial link. That is, the serial port log information output by the target serial port will be transmitted to the second serial controller through the second serial link, and then output to the remote device. In this case, obtaining and storing a copy of the serial port log information transmitted on the second serial link realizes the recording of the serial port log information of the target serial port during the remote device's access to the target serial port, ensuring the integrity of the serial port log information.

[0043] The serial port logging method provided in this application can be applied to various types of computer devices such as terminals, servers, and routers. The structure of the computer device used in this application will be described below.

[0044] Figure 1 This is a schematic diagram of the structure of a computer device to which the serial port logging method provided in this application embodiment is applied. Figure 1 As shown, the computer device 100 may include a BMC 110, a CPLD 120, and multiple serial port devices 130. The multiple serial port devices 130 can be connected to the BMC 110 via the CPLD 120.

[0045] The BMC 110 is a dedicated chip or microcontroller located on the motherboard of computer device 100. The BMC 110 has an independent processor, memory, and network interface, and can be used to monitor, manage, and control various aspects of computer device 100.

[0046] In this embodiment, the BMC 110 includes multiple serial controllers. Each serial controller includes a serial port, where a serial port refers to a serial interface. For example, the serial port can be a universal asynchronous receiver / transmitter (UART) interface. Additionally, the BMC 110 is configured with SOL functionality; based on this, the multiple serial controllers include a remote login controller, which is used to establish an SOL connection with a remote device to enable the remote device to log in to the computer device.

[0047] Multiple serial devices 130 each have a serial port, such as a UART interface. The serial ports of these multiple serial devices 130 are connected to the serial controller on the BMC 110 via the CPLD 120.

[0048] In some embodiments, the plurality of serial port devices 130 may include a processing chip 131 and a device controller 132.

[0049] The processing chip 131 can be the control center of the computer device 100. For example, the processing chip 131 can be a processor or a collective term for multiple processing elements. For instance, the processing chip 131 can be a central processing unit (CPU), an image processor, a neural network processor, an application-specific integrated circuit (ASIC), one or more digital signal processors (DSPs), or one or more field-programmable gate arrays (FPGAs), etc.

[0050] The device controller 132 can be a control component for peripheral devices in the computer device 100. For example, the device controller 132 can be a hard disk controller, a network controller, etc.

[0051] The CPLD 120 is a digital circuit device with high logic gate density and programmability. A CPLD 120 typically consists of reconfigurable logic cells, input / output pins, and internal interconnects. It is a common serial communication interface protocol device. Compared to ordinary programmable logic devices (such as simple programmable logic devices or programmable gate arrays), the CPLD 120 offers greater scale and a higher level of programmability, enabling the implementation of more complex circuit functions and providing greater flexibility and scalability.

[0052] In this embodiment, the CPLD 120 includes a processing unit 121 and a multiplexer (MUX) 122. Under the control of the processing unit 121, for any of the multiple serial port devices 130, the MUX 122 can establish or disconnect the connection between the serial port on the serial port device and the corresponding serial controller on the BMC. The serial controller on the BMC corresponding to the serial port refers to the serial controller originally assigned to and used for connecting to the serial port. When the connection between the serial port on the serial port device and the corresponding serial controller on the BMC 110 is disconnected, the MUX 122 can also establish a connection between the serial port on the serial port device and the remote login controller on the BMC 110, thereby redirecting the traffic of the serial port on the serial port device, allowing remote devices to access the serial port device.

[0053] Optionally, the CPLD 120 may also include a storage unit, for example, a random access memory (RAM), such as static random access memory (SRAM).

[0054] As an example, see Figure 1 The processing chip 131 is a CPU with multiple serial ports, each of which can be allocated to at least one functional unit. Therefore, each serial port can be used to send and receive relevant information for its corresponding functional unit. This functional unit can be either a software unit or a hardware unit.

[0055] For example, a CPU can run a basic input and output system (BIOS) and an operating system (OS). Based on this, the CPU can have a serial port 1311 corresponding to the BIOS or OS, used to send and receive BIOS or OS-related information, such as outputting OS log information and receiving commands to configure or operate the OS. As another example, the CPU can receive information from an IMU (Integrated Device Unit). Correspondingly, the CPU can have a serial port 1312 corresponding to the IMU, used to send and receive IMU-related information, such as outputting IMU operating information and motion data acquired by the IMU, and also receiving control commands for the IMU.

[0056] The device controller 132 can be a hard disk controller. This hard disk controller can be used to manage and control at least one hard disk. The hard disk controller may have a serial port 1321 for sending and receiving information related to the hard disk controller, for example, it can be used to output status information of at least one hard disk managed and controlled by the hard disk controller.

[0057] The BMC 110 includes five serial controllers 111 to 115. Serial controller 111 corresponds to serial port 1311 on the CPU, serial controller 112 corresponds to serial port 1312 on the CPU, and serial controller 113 corresponds to serial port 1321 on the hard disk controller. Serial controller 115 is a remote login controller used to connect to remote devices.

[0058] Optionally, in some possible cases, the multiple serial port devices 130 may also include a BMC 110, which has a serial port 116 for sending and receiving relevant information of the BMC 110, for example, it can be used to output log information of the BMC 110. Based on this, the serial controller 114 can be the serial controller corresponding to the serial port 116 on the BMC 110.

[0059] It should be noted that, when the remote device is not logged in, the serial ports of each of the aforementioned serial devices establish a serial link with the serial port on their respective serial controller via the MUX 122 in the CPLD 120. Through this serial link, the serial ports of each serial device can output serial port log information to the corresponding serial controller. Accordingly, the corresponding serial controller has the function of recording the serial port log information of its respective serial port.

[0060] After a remote device logs into computer device 100 via a remote login controller, taking serial port 1311 on the CPU as an example, when the remote device wants to access the operating system corresponding to serial port 1311, it can send a serial port access command to CPLD 120 through the remote login controller. In response to this serial port access command, processing unit 121 in CPLD 120 controls MUX 122 to disconnect the serial link between serial port 1311 and serial controller 111 on BMC 110, and establish a serial link between serial port 1311 and serial controller 115 on BMC 110. In this way, serial port 1311 will be redirected to serial controller 115, and the remote device can communicate with serial port 1311 through serial controller 115 to access the operating system, such as controlling the operating system to perform certain operations, obtaining operating system running information, etc.

[0061] During the communication between the remote device and the serial port 1311 via the serial controller 115, the processing unit 121 in the CPLD 120 can use the serial port log recording method provided in this application embodiment to record the serial port log information output by the serial port 1311, ensuring the integrity of the serial port log information during the remote device's access to the operating system.

[0062] The above is primarily an illustrative example of remote device access to the operating system. For other serial ports, when a remote device accesses the corresponding serial port, the CPLD 120 can record the serial port log information of the corresponding serial port during the remote access process using the serial port log recording method provided in this application embodiment, thereby ensuring the integrity of the serial port log information.

[0063] It is worth noting that the CPLD 120 in the aforementioned computer device can also be implemented by other types of digital integrated circuits. For example, it can be implemented by FPGA, PLD, or other types of processing chips, and this application embodiment does not specifically limit this.

[0064] In addition, the aforementioned computer device 100 may also include other components, such as a memory and a communication bus. The memory may be independent and connected to the CPU and CPLD 120 via the communication bus. The memory may store program code and data; for example, it may store program code for implementing the serial port logging method provided in this embodiment. The CPLD 120 can then read and execute the program code stored in the memory to implement the serial port logging method provided in this embodiment.

[0065] The serial port logging method provided in this application embodiment will be described in detail below.

[0066] Figure 2 This is a flowchart illustrating a serial port logging method provided in an embodiment of this application. This method can be applied to a CPLD in the aforementioned computer device or to other types of digital integrated circuits used to connect the serial port on a serial device to the serial controller on a BMC. Below, taking the application of this serial port logging method to a CPLD as an example, the detailed implementation process of the serial port logging method will be described. See also... Figure 2 The method includes the following steps:

[0067] S201: In response to a serial port access command, disconnect the first serial link between the target serial port of the target serial port device in the computer device and the first serial controller on the BMC, and establish a second serial link between the target serial port and the second serial controller.

[0068] In this embodiment, the computer device can enable the SOL function of the BMC and establish an SOL connection between the second serial controller on the BMC and the remote device. The second serial controller is a serial controller configured in the computer device for remote devices to log in to the computer device via the SOL connection. That is, the second serial controller is a remote login controller.

[0069] After the BMC establishes a SOL connection with the remote device through the second serial controller, the BMC can receive serial port access commands sent by the remote device through this SOL connection. These commands indicate the target serial port that the remote device wishes to access; the target serial port is the serial port on the target serial port device. The BMC can send this serial port access command to the CPLD. Upon receiving the command, the CPLD can determine the target serial port and the first serial controller to which it is connected, and then redirect the target serial port from its original connection to the first serial controller to the second serial controller with which the remote device has established an SOL connection.

[0070] It should be noted that the serial controller corresponding to the target serial port on the BMC is the first serial controller, which has the function of recording the serial port log information of the target serial port. That is, before the target serial port is redirected, the target serial port is connected to the first serial controller through the CPLD. The connection between the target serial port and the first serial controller can be referred to as the first serial link.

[0071] In one possible implementation, the serial port identifiers on each serial port device in the computer equipment are different. In this case, the serial port access command can carry the target serial port identifier. Accordingly, the CPLD can determine the target serial port to be accessed by the remote device based on the target serial port identifier, and then determine the first serial controller connected to the target serial port based on the target serial port.

[0072] In another possible implementation, the serial port access command may carry the identifier of the target functional unit to be accessed by the remote device. In this case, the CPLD can determine the target serial port corresponding to the target functional unit based on the identifier of the target functional unit to be accessed, and then determine the first serial controller connected to the target serial port based on the target serial port.

[0073] After identifying the target serial port and the first serial controller to which it is connected, the CPLD can disconnect the target serial port from the first serial controller, thus breaking the first serial link. Then, the CPLD can establish a connection between the target serial port and the second serial controller to redirect the target serial port to the second serial controller. This connection between the target serial port and the second serial controller can be referred to as the second serial link.

[0074] For example, see Figure 3In a computer device, serial port A1 on the CPU corresponds to the computer's operating system and can be used to output OS-related information. Before redirection, serial port A1 is connected to input port T1 of the MUX in the CPLD. Input port T1 of the MUX is connected to output port R1, and output port R1 of the MUX is connected to serial port P1 of UART controller 1 on the BMC. Thus, a first serial link L1 is established between serial port A1 and UART controller 1 through the CPLD. After receiving a serial access command indicating access to serial port A1, the CPLD can control the MUX to disconnect the connection between input port T1 and output port R1, and connect input port T1 to output port R2. Output port R2 is then connected to UART controller 2 on the BMC, which is the remote login controller. Thus, the first serial link L1 between serial port A1 and UART controller 1 is disconnected through the CPLD, and a second serial link L2 is established between serial port A1 and UART controller 2.

[0075] S202: Obtain a copy of the serial port log information transmitted via the second serial link.

[0076] After the first serial link between the target serial port and the first serial controller is disconnected, the information output by the target serial port will no longer be able to be transmitted to the first serial controller through the first serial link.

[0077] In addition, the CPLD establishes a second serial link between the target serial port and the second serial controller. Based on this, the remote device can access the target functional unit corresponding to the target serial port through the second serial controller and the second serial link. The target functional unit can be a software unit running on the target serial port device, or a hardware unit included in the target serial port device or having a communication connection with it.

[0078] For example, the target serial port device can receive configuration information or operation commands sent by the remote device through the second serial controller and the second serial link via the target serial port, and use the configuration information or operation commands to control the target functional unit to perform corresponding operations. In addition, the target serial port device can also output relevant information of the target functional unit to the remote device through the target serial port, the second serial link, and the second serial controller.

[0079] For example, still using Figure 3For example, the target functional unit is the operating system (OS) of a computer device running on the CPU. After the CPLD establishes the second serial link L2 between serial port A1 and UART controller 2, the CPU can receive target operation instructions from the remote device transmitted via the second serial link L2 through serial port A1, and control the OS to execute the target operation based on these instructions. Afterwards, the CPU can receive the OS's response to the target operation instruction and transmit this response to the remote device through the second serial link L2. In addition, the CPU can also transmit other operating information of the OS to the remote device through the second serial link L2.

[0080] During the communication between the target serial port device and the remote device via the second serial link, the serial port log information output by the target serial port device through the target serial port will reach the CPLD. Based on this, in this embodiment, after receiving the serial port log information output by the target serial port device through the target serial port, the CPLD can copy the serial port log information to obtain a copy. Then, the CPLD can forward the received original serial port log information to the second serial controller via the MUX, so that the second serial controller can output the serial port log information to the remote device.

[0081] For example, see Figure 4 The target serial port device is the CPU, and the target serial port is serial port A1 on the CPU. Serial port A1 is the serial port corresponding to the OS. The target serial port device outputs serial port log information, including OS running information, to the CPLD processing unit through serial port A1. The CPLD processing unit copies the serial port log information to obtain a copy. Then, the processing unit inputs the serial port log information to the MUX, which sends the serial port log information to UART controller 2. Finally, UART controller 2 outputs the serial port log information to the remote device.

[0082] Optionally, as described above, the target serial port device can both output information to and receive information sent by the remote device via the second serial link. Based on this, in some possible cases, the CPLD can also copy the information transmitted on the second serial link destined for the target serial port; that is, it can also copy the information to be received by the target serial port as serial port log information.

[0083] Optionally, considering that the information sent by the remote device to the target serial port may involve the user's privacy information, in this embodiment of the application, the CPLD can filter the privacy information in the information transmitted on the second serial link and to be received by the target serial port, and copy the filtered information as serial port log information.

[0084] Of course, a CPLD can also choose not to copy or record information sent by a remote device to a target serial port device via a second serial link. In other words, the CPLD can choose not to record information to be received by the target serial port, thereby protecting user privacy and improving security.

[0085] S203: Stores a copy of the serial port log information.

[0086] After obtaining a copy of the serial port log information transmitted on the second serial link, the CPLD can store this copy of the serial port log information as the serial port log information of the target serial port.

[0087] In one possible implementation, since the first serial controller is a controller used to record the serial port log information of the target serial port, the CPLD can send a copy of the serial port log information to the first serial controller, which then stores the copy of the serial port log information as the serial port log information of the target serial port.

[0088] For example, still using Figure 4 For example, after the CPLD processing unit obtains a copy of the serial port log information of serial port A1, it can send the copy of the serial port log information to UART controller 1. After receiving the copy of the serial port log information, UART controller 1 can store the copy of the serial port log information.

[0089] In another possible implementation, if the CPLD has a storage unit, it can also store a copy of the serial port log information transmitted on the second serial link in its own storage unit. For example, if the CPLD is equipped with SDRAM, it can temporarily store the copy of the serial port log information in the SDRAM. Alternatively, the CPLD can also send the obtained copy of the serial port log information to the memory of a computer device for storage.

[0090] In this embodiment, after disconnecting the first serial link between the target serial port of the target serial port device and the original first serial controller, and establishing a second serial link between the target serial port and the second serial controller, the target serial port device will communicate with the remote device through the second serial link. That is, the serial port log information output by the target serial port will be transmitted to the second serial controller through the second serial link, and then output to the remote device. In this case, a copy of the serial port log information transmitted on the second serial link can be obtained, and this copy of the serial port log information can be stored as the serial port log information of the target serial port. This achieves the recording of the serial port log information of the target serial port during the remote device's access to the target serial port, ensuring the integrity of the serial port log information.

[0091] Furthermore, if the remote device performs certain operations on the target functional unit corresponding to the target serial port during access to the target serial port, and the target functional unit returns a response, the serial port log information of the target serial port obtained by the serial port log recording method provided in this application embodiment will include the response returned by the target functional unit. In this way, if the target functional unit encounters an abnormality after the user operates on the target functional unit through the remote device, the response returned by the target functional unit recorded in the serial port log information of the target serial port can be used to better locate and resolve the abnormality.

[0092] The serial port logging device provided in the embodiments of this application will be described next.

[0093] Figure 5 This is a schematic diagram of a serial port logging device provided in an embodiment of this application. This serial port logging device can be deployed in the aforementioned computer equipment, for example, it can be deployed on the CPLD of the aforementioned computer equipment. Figure 5 As shown, the serial port log recording device 500 includes: a link switching module 501, a serial port log acquisition module 502, and a serial port log storage module 503.

[0094] The link switching module 501 is used to execute S201 in the aforementioned embodiment; the serial port log acquisition module 502 is used to execute S202 in the aforementioned embodiment; and the serial port log storage module 503 is used to execute S203 in the aforementioned embodiment.

[0095] Optionally, the serial port log acquisition module 502 is specifically used to: copy the serial port log information sent by the target serial port device to the second serial controller through the second serial link, and obtain a copy of the serial port log information.

[0096] Optionally, the first serial controller is a controller for recording serial port log information output by the target serial port, and the serial port log storage module 503 is specifically used to: send a copy of the serial port log information to the first serial controller for storage.

[0097] Optionally, the target serial port device can be any one of a central processing unit (CPU), a device controller, and a BMC.

[0098] Optionally, if the target serial port device is a CPU, the target serial port is the serial port corresponding to the operating system of the computer device, or the target serial port is the serial port corresponding to the inertial measurement unit (IMU).

[0099] In this embodiment, after disconnecting the first serial link between the target serial port of the target serial port device and the original first serial controller, and establishing a second serial link between the target serial port and the second serial controller, the target serial port device will communicate with the remote device through the second serial link. That is, the serial port log information output by the target serial port will be transmitted to the second serial controller through the second serial link, and then output to the remote device. In this case, a copy of the serial port log information transmitted on the second serial link can be obtained, and this copy of the serial port log information can be stored as the serial port log information of the target serial port. This achieves the recording of the serial port log information of the target serial port during the remote device's access to the target serial port, ensuring the integrity of the serial port log information.

[0100] It should be noted that the module division in the serial port logging device provided in the above embodiments is illustrative and only represents one logical functional division. In actual implementation, other division methods are also possible. Furthermore, the functional modules in the various embodiments of this application can be integrated into a single processor, exist as separate physical entities, or be integrated into a single module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0101] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, essentially, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a server or terminal, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0102] Furthermore, the serial port logging device and the serial port logging method provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.

[0103] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. 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 from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., digital versatile discs (DVDs)), or semiconductor media (e.g., solid-state disks (SSDs)).

[0104] In the various embodiments of this application, unless otherwise specified or logically conflicting, the terminology and / or descriptions between different embodiments are consistent and can be referenced mutually. Technical features in different embodiments can be combined to form new embodiments based on their inherent logical relationships. In the embodiments of this application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the association relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone, where A and B can be singular or plural. In the textual description of the embodiments of this application, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. In this application, "first," "second," and various numerical designations are only for ease of description and are not used to limit the scope of the embodiments of this application. For example, they are used to distinguish different messages, rather than to describe a specific order or sequence.

[0105] It is understood that the various numerical designations used in the embodiments of this application are merely for descriptive convenience and are not intended to limit the scope of the embodiments of this application. The order of the process numbers does not imply the order of execution; the execution order of each process should be determined by its function and internal logic.

[0106] Finally, it should be noted that the above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A serial port log recording method, characterized in that, The method includes: Based on the serial port access command, the first serial link between the target serial port of the target serial port device in the computer device and the first serial controller on the baseboard management controller (BMC) is disconnected, and a second serial link between the target serial port and the second serial controller is established. The second serial controller is the serial controller used by the remote device to log in to the computer device. Obtain a copy of the serial port log information transmitted through the second serial link, and store the copy of the serial port log information.

2. The method according to claim 1, characterized in that, The step of obtaining a copy of the serial port log information transmitted through the second serial link includes: The serial port log information sent by the target serial port device to the second serial controller through the second serial link is copied to obtain a copy of the serial port log information.

3. The method according to claim 1 or 2, characterized in that, The first serial controller is a controller for recording serial port log information output by the target serial port, and the storage of a copy of the serial port log information includes: A copy of the serial port log information is sent to the first serial controller for storage.

4. The method according to any one of claims 1 to 3, characterized in that, The target serial port device is any one of the central processing unit (CPU), the device controller, and the BMC.

5. The method according to any one of claims 1 to 4, characterized in that, When the target serial port device is a CPU, the target serial port is the serial port corresponding to the operating system of the computer device, or the target serial port is the serial port corresponding to the inertial measurement unit (IMU).

6. A serial port log recording device, characterized in that, The serial port log recording device includes: The link switching module is used to disconnect the first serial link between the target serial port of the target serial port device in the computer device and the first serial controller on the baseboard management controller (BMC) in response to the serial port access command, and establish a second serial link between the target serial port and the second serial controller, wherein the second serial controller is the serial controller used by the remote device to log in to the computer device. The serial port log acquisition module is used to acquire a copy of the serial port log information transmitted through the second serial link; The serial port log storage module is used to store a copy of the serial port log information.

7. The apparatus according to claim 6, characterized in that, The serial port log acquisition module is specifically used for: The serial port log information sent by the target serial port device to the second serial controller through the second serial link is copied to obtain a copy of the serial port log information.

8. The apparatus according to claim 6 or 7, characterized in that, The first serial controller is a controller used to record serial port log information output by the target serial port, and the serial port log storage module is specifically used for: A copy of the serial port log information is sent to the first serial controller for storage.

9. A computer device, characterized in that, The computer device includes a complex programmable logic device (CPLD), a baseboard management controller (BMC), and a target serial port device. The BMC includes a first serial controller and a second serial controller. The target serial port on the target serial port device is connected to the first serial controller or the second serial controller through the CPLD. The CPLD is used to execute at least one program instruction or code stored in the memory to implement the serial port logging method according to any one of claims 1 to 5.

10. The computer device according to claim 9, characterized in that, The target serial port device is any one of the central processing unit (CPU), the device controller, and the BMC.