Remote debugging method for intelligent terminal
Through customized binary protocols and instruction formats, the intelligent terminal actively initiates the connection and automatically exits the mechanism, which solves the complex configuration problem of remote debugging of Linux devices in the intranet environment and realizes an efficient and secure remote debugging process.
Patent Information
- Application Number
- CN202510627678.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-15
- Publication Date
- 2025-09-19
AI Technical Summary
When connecting to Linux devices in other intranet environments, existing technologies require the use of NAT penetration, VPN networking, etc., which leads to complex network configuration, prone to configuration errors, increased operation and maintenance costs and technical difficulty, and affected the stability and efficiency of remote debugging.
Using a custom binary protocol and instruction format, the intelligent terminal front-end actively initiates the connection, the client automatically collects and sends device information, the server performs verification and connection management, and direct debugging is achieved. It automatically exits when there is no server response, reducing resource usage.
It simplifies the remote connection configuration of intranet devices, improves the stability and efficiency of debugging, reduces operation and maintenance costs, and ensures the accuracy and security of data transmission.
Smart Images

Figure CN120676029A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of intelligent terminal debugging, and in particular to a remote debugging method for an intelligent terminal. Background Art
[0002] With the rapid development of the Internet of Things, industrial control, smart devices and other fields, Linux-based embedded devices are increasingly used in various industries. Traditional local debugging methods are difficult to meet the needs of remote maintenance and real-time debugging of large-scale equipment. Network-based remote debugging technology has become one of the key technologies to improve the efficiency of embedded system development and maintenance.
[0003] For example, the method for remotely executing service commands by a smart terminal based on WiFi, published with the publication number CN105306536B, includes the smart terminal establishing a connection with the smart routing gateway via WiFi, the smart routing gateway obtaining the IP address, port number, and basic information of the smart terminal; establishing a network channel between the smart routing gateway and the smart terminal; the remote server obtaining channel data transmitted by the smart terminal through the network channel; the remote server parsing the channel data and storing the parsed data; and the remote server determining whether the remote service program has obtained the parsed data.
[0004] In the existing technology, in the existing Linux remote connection technology system, with the help of ssh service, technicians can easily achieve direct connection to Linux devices in the internal LAN and Linux devices with public IP. However, when facing the need to connect to Linux devices in other intranet environments, other technical approaches such as NAT penetration and VPN networking are needed to achieve the connection goal. These connection methods not only require the configuration of a dedicated penetration server in the network, increasing the hardware purchase cost and operation and maintenance workload, but also in the actual operation process, the network configuration process is complicated, involving multiple settings such as port mapping and address translation, which are prone to configuration errors. Configuration errors will lead to unstable connection or even inability to connect, which hinders remote debugging work. This not only increases technical difficulty, but also increases operation and maintenance costs. Summary of the Invention
[0005] The purpose of the present invention is to provide a remote debugging method for smart terminals to solve the problem proposed in the above background technology that when facing the demand of connecting to Linux devices in other intranet environments, it is necessary to use other technical approaches such as NAT penetration and VPN networking to achieve the connection target. In actual operation, the network configuration process is complicated and configuration errors are prone to occur, which hinders the remote debugging work.
[0006] To achieve the above object, the present invention provides the following technical solution: a remote debugging method for an intelligent terminal, comprising the following steps:
[0007] S1. The front-end processor of the intelligent terminal starts the remote debugging client: The front-end processor sends a startup command to the Linux device, and the device starts the remote debugging client program after receiving the command.
[0008] S2. When the client program is started, it will immediately initiate a connection request with the specified TCP server. After the connection is successfully established, the client will collect device information and encapsulate this information into data packets and send them to the server through the connection.
[0009] S3. After receiving the client's connection and device information, the server maintains the connection status. Through this connection, the server can communicate with the client in real time. At the same time, the server will make judgments based on the information reported by the client, and only devices that meet the conditions will be included in the subsequent interaction process.
[0010] S4. The server sends commands and file operations to the client: The server and the client perform debugging command interactions and upload and download files for operations;
[0011] S5: Client automatic logout mechanism: Based on the preset time threshold and energy-saving strategy, if the client does not receive any server information for 5 consecutive minutes, the logout procedure will be automatically executed.
[0012] Preferably, in step S1, the smart terminal front-end starts the Linux client and specifically includes the following steps:
[0013] S11. Initiate command: The front-end processor of the intelligent terminal generates a remote debugging command for triggering the client to start according to a preset communication protocol and command format; wherein the communication protocol is a custom binary protocol for improving transmission efficiency and security;
[0014] S12. Sending and receiving instructions: The front-end processor of the intelligent terminal sends the packaged startup instruction to the main business program of the Linux device through the network. After receiving the instruction, the main business program starts the remote debugging client program through the Linux command line interface based on the system call mechanism.
[0015] Preferably, in step S2, the client sends the local information to the server specifically including the following steps:
[0016] S21. Information collection: After the Linux client is started, it automatically collects detailed information about the local machine;
[0017] S22. Information packaging and transmission: The client packages the collected information according to a standard data format and sends the data packets to the server via the network.
[0018] Preferably, in step S3, the server identifying and establishing a connection specifically includes the following steps:
[0019] S31. After receiving the connection request from the client, the server registers and maintains the session state of the connection in the internal connection management module. The connection, as the carrier of the communication channel, will be continuously maintained and used for subsequent two-way interactive operations, including client status monitoring and debugging command issuance.
[0020] S32. During the communication process, the server will make judgments based on the device information reported by the client, such as whether the network status meets the debugging communication requirements and whether the terminal ID is correct, to ensure that the device meets the access standards; only when all conditions are verified, the server will include the client in the subsequent interaction process and allow it to enter the debugging session or receive remote control instructions; then, the server's management interface will automatically display the client terminal ID and IP address.
[0021] Preferably, in step S4, the server sends commands and file operations to the client including the following:
[0022] S41. Command interaction: Select the client to communicate with in the server interface and enter the debugging command. The server encapsulates the command into a specific format and sends it to the client. After receiving the command, the client parses and processes it and responds. After receiving the response from the client, the server displays the processing result on the output interface and sends a response command to end this round of communication.
[0023] S42. File operation: Perform file operations on the server software interface. After selecting a file, click Download. The server will send a download request to the client. Click Upload. After selecting the required program or file, the server will send the file data in blocks to the client. The client receives and saves the file, completing the upgrade operation of the client software or program.
[0024] Preferably, in step S5, during the operation of the automatic logout mechanism of the client, a timer is started to monitor in real time whether information is received from the server. If no information is received from the server within five consecutive minutes, the automatic logout mechanism is triggered.
[0025] Compared with the prior art, the present invention has the following beneficial effects:
[0026] The present invention ensures the accuracy and reliability of instruction transmission through customized binary protocols and specific instruction formats, which is convenient for subsequent upgrades and maintenance of the protocol; the client automatically collects and sends detailed local information, providing data support for the server to accurately identify the client and establish a connection, and the client's automatic exit mechanism operates according to a reasonable time threshold, which can not only reduce server resource usage but also not interfere with the normal debugging process, thereby achieving stability, security and efficiency of remote debugging. While ensuring accurate data transmission, it takes into account the rational use of resources and the effective use of debugging functions, greatly improving the practicality and convenience of remote debugging of smart terminals. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 The present invention is a flowchart of a remote debugging method for an intelligent terminal. DETAILED DESCRIPTION
[0028] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the implementation regulations described are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.
[0029] Example 1: Reference Figure 1 As shown: This application has built a remote debugging system suitable for debugging Linux smart terminals in an intranet environment. The core is to solve the problems of complex remote connection and high configuration difficulty of Linux devices in the intranet environment, reduce technical difficulty and operation and maintenance costs, and improve the remote management efficiency of large-scale equipment.
[0030] 1. Technical solution (core steps)
[0031] 1. The smart terminal front-end starts the remote debugging client (S1)
[0032] S11. Initiate command: The front-end processor of the intelligent terminal generates a remote debugging command for triggering the client to start according to a preset communication protocol and command format; wherein the communication protocol is a custom binary protocol for improving transmission efficiency and security;
[0033] S12. Sending and receiving instructions: The front-end processor of the intelligent terminal sends the packaged startup instruction to the main business program of the Linux device through the network. After receiving the instruction, the main business program starts the remote debugging client program through the Linux command line interface based on the system call mechanism.
[0034] 2. The client sends local information to the server (S2)
[0035] Information collection (S21): The client automatically collects system network information and terminal ID.
[0036] Information packaging and transmission (S22): Packing information in a standard format and sending it to the server through the network to provide data support for subsequent connections.
[0037] 3. Server recognizes and establishes connection (S3)
[0038] Information verification (S31): The server verifies the client information according to preset rules.
[0039] Connection establishment (S32): After verification, a connection is established to ensure security; after a successful connection, the server interface displays the terminal ID and client IP address.
[0040] 4. Command interaction and file operations between server and client (S4)
[0041] Command interaction (S41): The server encapsulates the debugging command and sends it to the client, which parses and processes it and responds; the server receives the response, displays the processing result, and sends an end command, completing one round of communication.
[0042] File operation (S42): downloading or uploading files.
[0043] 5. Client automatic logout mechanism (S5)
[0044] The client starts a timer to monitor server information. If no data is received for 5 consecutive minutes, it will trigger an automatic exit, reducing server resource usage and balancing energy saving and debugging needs.
[0045] 2. Technical Principle
[0046] 1. Core design goals
[0047] Simplify intranet connections: Avoid the complex configuration of traditional NAT penetration and VPN networking. The client actively reports information to the server, and the server initiates a reverse connection, enabling direct debugging of intranet devices.
[0048] Reliable transmission and security: Customized protocols ensure error-free instructions.
[0049] 2. Key technical points
[0050] Custom binary protocol:
[0051] It replaces traditional general protocols such as SSH, improves transmission efficiency through lightweight design, and facilitates subsequent function expansion and protocol upgrades.
[0052] Proactive reporting and identification:
[0053] After startup, the client initiates a connection to the server via TCP and uploads its network and device information. Because the connection is established proactively by the client, the server can still send commands or data to the device through this connection, even if the device is behind a NAT or firewall, eliminating the need for traditional port mapping configurations and enabling remote access to intranet devices.
[0054] Resource optimization mechanism:
[0055] The automatic logout mechanism prevents idle clients from occupying server resources for a long time. It is suitable for large-scale equipment debugging scenarios and improves the overall efficiency of the system.
[0056] Example 2: Reference Figure 1 A remote debugging method for an intelligent terminal includes the following steps:
[0057] S1. The front-end processor of the intelligent terminal starts the remote debugging client: The front-end processor sends a startup command to the Linux device, and the device starts the remote debugging client program after receiving the command.
[0058] The following steps are involved in starting the Linux client on the smart terminal front-end:
[0059] S11. Initiate command: The front-end processor of the intelligent terminal generates a remote debugging command for triggering the client to start according to a preset communication protocol and command format; wherein the communication protocol is a custom binary protocol for improving transmission efficiency and security;
[0060] S12. Sending and receiving instructions: The front-end processor of the intelligent terminal sends the packaged startup instruction to the main business program of the Linux device through the network. After receiving the instruction, the main business program starts the remote debugging client program through the Linux command line interface based on the system call mechanism.
[0061] S2. When the client program is started, it will immediately initiate a connection request with the designated TCP server. After the connection is successfully established, the client will collect device information and encapsulate this information into data packets and send them to the server through the connection;
[0062] The client sends local information to the server in the following steps:
[0063] S21. Information Collection: After the Linux client is started, it automatically collects detailed information about the client, including network information and terminal ID. The terminal ID serves as the client's identity tag, ensuring that the server can accurately identify the client and providing a key basis for establishing a reliable connection.
[0064] S22. Information Packaging and Transmission: The client packages the collected information in a standard data format and sends the data packets to the server via the network so that the server can identify the client and establish a connection.
[0065] S3. After receiving the client's connection and device information, the server will maintain the connection status. Through this connection, the server can communicate with the client in real time. At the same time, the server will make judgments based on the information reported by the client, and only devices that meet the conditions will be included in the subsequent interaction process;
[0066] The server identification and connection establishment specifically include the following steps:
[0067] S31. After receiving the client's connection request, the server registers and maintains the session state of the connection in the internal connection management module. This connection, as the carrier of the communication channel, will be continuously maintained and used for subsequent two-way interactive operations, including client status monitoring and debugging command issuance.
[0068] S32. During the communication process, the server will make judgments based on the device information reported by the client, such as whether the network status meets the debugging communication requirements and whether the unique identification number is correct, to ensure that the device meets the access standards. Only if all conditions are verified, the server will include the client in the subsequent interaction process and allow it to enter the debugging session or receive remote control commands. At the same time, the server's management interface will automatically display the client's unique identification number and IP address.
[0069] S4. The server sends commands and file operations to the client: The server and the client interact with each other through debugging commands, uploading and downloading files for convenient operations;
[0070] The server sends commands and file operations to the client, including the following:
[0071] S41. Command interaction: Select the client to communicate with in the server interface and enter the debugging command. The server encapsulates the command into a specific format and sends it to the client. After receiving the command, the client parses and processes it and makes a corresponding response. After receiving the client's response, the server displays the processing result on the output interface and sends a response command at the same time, announcing the end of this round of communication.
[0072] S42. File operation: Perform file operations on the server software interface. After selecting a file, click Download. The server will send a download request to the client. Click Upload. After selecting the required program or file, the server will send the file data in blocks to the client. The client receives and saves the file, completing the upgrade operation of the client software or program.
[0073] S5: Client automatic logout mechanism: Based on the preset time threshold and energy-saving strategy, if the client does not receive server information for 5 consecutive minutes, it will automatically execute the logout procedure to reduce server resource usage;
[0074] In the client's automatic exit mechanism, during operation, the client will start a timer to monitor in real time whether it has received any information from the server. If no information is received from the server within five consecutive minutes, the automatic exit mechanism will be triggered. The five-minute time threshold is a reasonable value obtained through analysis and testing of actual debugging scenarios. It can avoid occupying server resources for too long and will not affect normal debugging operations.
[0075] The present invention first starts the Linux client by the front-end processor of the intelligent terminal. The front-end processor acts as the instruction initiator and generates the startup instruction according to the custom binary protocol. Then, the front-end processor sends the instruction to the Linux client. After the client parses the instruction, it starts the relevant service process to prepare for debugging.
[0076] Then, after the Linux client is started, it automatically sends local information to the server. The client first collects detailed information such as network information and terminal ID, then packages the information and transmits it to the server through the network to facilitate the server to identify the client. The server identifies and verifies the client information. After the verification is passed, a connection is established. After the connection is successful, the server management interface displays the terminal ID and client IP address.
[0077] Afterwards, the server and the client perform command interaction and file operations. In terms of command interaction, the server encapsulates the debugging command and sends it to the client. The client processes and responds, and the server displays the result and declares the end of communication. During file operations, the server can send file download or upload requests to the client to implement client software upgrades. In order to reduce server resource usage, the client has an automatic exit mechanism. When the client is running, it starts a timer to monitor server information. If no information is received for 5 consecutive minutes, it will automatically exit the program. The time threshold is set after actual testing to balance resource usage and debugging requirements. Through the above process, remote debugging of smart terminals is realized, ensuring that debugging work is carried out efficiently, stably and safely.
[0078] Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments, or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A remote debugging method for an intelligent terminal, characterized in that: The following steps are involved: S1. The front-end processor of the intelligent terminal starts the remote debugging client: The front-end processor sends a startup command to the Linux device, and the device starts the remote debugging client program after receiving the command. S2. When the client program is started, it will immediately initiate a connection request with the designated TCP server. After the connection is successfully established, the client will collect device information and encapsulate this information into data packets and send them to the server through the connection; S3. After receiving the client's connection and device information, the server will maintain the connection status. Through this connection, the server can communicate with the client in real time. At the same time, the server will make judgments based on the information reported by the client, and only devices that meet the conditions will be included in the subsequent interaction process; S4. The server sends commands and file operations to the client: The server and the client perform debugging command interactions and upload and download files for operations; S5: Client automatic logout mechanism: Based on the preset time threshold and energy-saving strategy, if the client does not receive any server information for 5 consecutive minutes, the logout procedure will be automatically executed.
2. A remote debugging method for an intelligent terminal according to claim 1, characterized in that: In step S1, the process of the intelligent terminal front-end starting the remote debugging client specifically includes the following sub-steps: S11. Initiate command: The front-end processor of the intelligent terminal generates a remote debugging command for triggering the client to start according to a preset communication protocol and command format; wherein the communication protocol is a custom binary protocol for improving transmission efficiency and security; S12. Sending and receiving instructions: The front-end processor of the intelligent terminal sends the packaged startup instruction to the main business program of the Linux device through the network. After receiving the instruction, the main business program starts the remote debugging client program through the Linux command line interface based on the system call mechanism.
3. The remote debugging method for an intelligent terminal according to claim 1, wherein: In step S2, the client sends the local information to the server, specifically including the following steps: S21. Information collection: After the Linux client is started, it automatically collects detailed information about the local machine; S22. Information packaging and transmission: The client packages the collected information according to a standard data format and sends the data packets to the server via the network.
4. The remote debugging method for an intelligent terminal according to claim 1, wherein: In step S3, the server identifies and establishes a connection, specifically including the following steps: S31. After receiving the connection request from the client, the server registers and maintains the session state of the connection in the internal connection management module. The connection, as the carrier of the communication channel, will be continuously maintained and used for subsequent two-way interactive operations, including client status monitoring and debugging command issuance; S32. During the communication process, the server will make judgments based on the device information reported by the client, such as whether the network status meets the debugging communication requirements and whether the terminal ID is correct, to ensure that the device meets the access standards. Only when all conditions are verified, the server will include the client in the subsequent interaction process and allow it to enter the debugging session or receive remote control instructions. Then, the server's management interface will automatically display the client terminal ID and IP address.
5. The remote debugging method for an intelligent terminal according to claim 1, wherein: In step S4, the server sends commands and file operations to the client, specifically including the following: S41. Command interaction: Select the client to communicate with in the server interface and enter the debugging command. The server encapsulates the command into a specific format and sends it to the client. After receiving the command, the client parses and processes it and responds. After receiving the response from the client, the server displays the processing result on the output interface and sends a response command to end this round of communication. S42. File operation: Perform file operations on the server software interface. After selecting a file, click Download. The server will send a download request to the client. Click Upload. After selecting the required program or file, the server will send the file data in blocks to the client. The client receives and saves the file.
6. The remote debugging method for an intelligent terminal according to claim 1, wherein: In step S5, during the operation of the automatic logout mechanism of the client, a timer will be started to monitor in real time whether information is received from the server. If no information is received from the server within five consecutive minutes, the automatic logout mechanism will be triggered.
Citation Information
Patent Citations
Method for remotely executing service commands using WiFi-based smart terminals
CN105306536B