CN107908576A - The method for realizing re-direction applications program standard output control - Google Patents
The method for realizing re-direction applications program standard output control Download PDFInfo
- Publication number
- CN107908576A CN107908576A CN201711290807.3A CN201711290807A CN107908576A CN 107908576 A CN107908576 A CN 107908576A CN 201711290807 A CN201711290807 A CN 201711290807A CN 107908576 A CN107908576 A CN 107908576A
- Authority
- CN
- China
- Prior art keywords
- application program
- output
- redirector
- pseudo
- standard output
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/10—Program control for peripheral devices
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The present invention relates to a kind of method for realizing re-direction applications program standard output control, this method includes the main equipment and slave device that redirector creates Linux pseudo-terminals, start application program using pseudo-terminal main equipment as standard output, in program operation process, redirector reads the output of application program from pseudo-terminal from the device, then prints to output on other output equipments.Employ the method for realizing re-direction applications program standard output control in the invention, can be in the case where not changing application code, realize redirection or the duplication of application program standard output, and support the output in multiple terminals while real-time display application program.Can also be during application program be run, switching at runtime redirects output equipment, improves the flexibility of Linux embedded devices debugging, simpler reliable.
Description
Technical field
The present invention relates to field of computer technology, more particularly to the export technique field of application program, in particular to one kind
The method for realizing re-direction applications program standard output control.
Background technology
In Linux embedded devices, the standard output of application program is typically all serial equipment, is dispatched from the factory installation in equipment
After shell, serial ports can not often use, can only be by the other-end of telnet etc come logging device, in order to pass through other
Terminal checks the real-time output information of application program, generally requires the switching for realizing standard output in the application, will export
Print on the output equipment specified, it is clear that this mode adds the complexity of application program, does not have source code for some
Application program, is difficult to realize the redirection of output, and can not also realize the function of multiple registration terminals while display output.
The content of the invention
A kind of the shortcomings that the purpose of the present invention is overcoming the above-mentioned prior art, there is provided realization weight that can flexibly debug
The method for orienting the control of application program standard output.
To achieve these goals, the method for realizing re-direction applications program standard output control of the invention has as follows
Form:
This realizes the method for re-direction applications program standard output control, it is mainly characterized by, the method include with
Lower step:
(1) redirector is called, and path and the operation of application program to be redirected are specified by command line parameter
Parameter;
(2) Linux pseudo-terminals are created;
(3) application program is started;
(4) output of application program is read from the Linux pseudo-terminals;
(5) output of the application program described in redirector printing described in.
This is realized in the step of method of re-direction applications program standard output control (2), the Linux pseudo-terminal bags
Include pseudo-terminal main equipment and pseudo-terminal slave device.
This realizes that the step of method of re-direction applications program standard output control (3) comprises the following steps:
(3.1) redirector described in calls the subprocess of the application program described in fork function creations;
(3.2) redirector described in calls dup2 functions that the standard output of the application program is arranged to described
Pseudo-terminal slave device;
(3.3) according to the path of the application program and operating parameter, exec functions are called to start the application journey
Sequence.
This realizes that the step of method of re-direction applications program standard output control (5) includes following two parallel steps
Suddenly:
(5.1) output of the application program is printed into the redirection output equipment of acquiescence;
(5.2) output of the application program is printed into standard output device.
This realizes in the step of method of re-direction applications program standard output control (5) that the redirector carries
For redirecting output equipment configuration interface, the redirector specifies new redirection to export by the configuration interface
Equipment.
The method for realizing re-direction applications program standard output control in the invention is employed, application can not changed
In the case of program code, redirection or the duplication of application program standard output are realized, and support real-time at the same time in multiple terminals
Show the output of application program.Can also be during application program be run, switching at runtime redirects output equipment, improves
The flexibility of Linux embedded devices debugging, it is simpler reliable.
Brief description of the drawings
Fig. 1 is the view of the method for realizing re-direction applications program standard output control of the present invention.
Embodiment
In order to more clearly describe the technology contents of the present invention, carried out with reference to specific embodiment further
Description.
This realizes the method for re-direction applications program standard output control, it is mainly characterized by, the method include with
Lower step:
(1) redirector is called, and path and the operation of application program to be redirected are specified by command line parameter
Parameter;
(2) Linux pseudo-terminals are created;
(3) application program is started;
(4) output of application program is read from the Linux pseudo-terminals;
(5) output of the application program described in redirector printing described in.
This is realized in the step of method of re-direction applications program standard output control (2), the Linux pseudo-terminal bags
Include pseudo-terminal main equipment and pseudo-terminal slave device.
This realizes that the step of method of re-direction applications program standard output control (3) comprises the following steps:
(3.1) redirector described in calls the subprocess of the application program described in fork function creations;
(3.2) redirector described in calls dup2 functions that the standard output of the application program is arranged to described
Pseudo-terminal slave device;
(3.3) according to the path of the application program and operating parameter, exec functions are called to start the application journey
Sequence.
This realizes that the step of method of re-direction applications program standard output control (5) includes following two parallel steps
Suddenly:
(5.1) output of the application program is printed into the redirection output equipment of acquiescence;
(5.2) output of the application program is printed into standard output device.
This realizes in the step of method of re-direction applications program standard output control (5) that the redirector carries
For redirecting output equipment configuration interface, the redirector specifies new redirection to export by the configuration interface
Equipment.
In practical applications, refering to Figure 1, it realizes re-direction applications program standard output control for the present invention
Method view.This method comprises the following steps:
(1) start redirector, path and the fortune of the application program that needs are redirected are specified by command line parameter
Row parameter;
(2) redirector creates Linux pseudo-terminals, including pseudo-terminal main equipment and slave device;
(3) redirector according to the application path in command line parameter and operating parameter create application program into
Journey, and the standard output of application program is arranged to the slave device of pseudo-terminal;
(4) output of application program is read in redirector circulation from pseudo-terminal main equipment, is then printed to output silent
On the redirection output equipment recognized;
(5) redirector, can also be same by output while output is printed to the redirection output equipment of acquiescence
Step prints to standard output device, realizes that reproducing standards is output to the function of re-positioning device;
(6) redirector, which provides, redirects output equipment configuration interface, in program operation process, can be matched somebody with somebody by this
Put interface and specify new redirection output equipment.
In practical applications, redirector provides the configuration interface that modification redirects output equipment, need not be again
In the case of starting application program, output equipment is redirected by the configuration interface switching at runtime.
In practical applications, redirector calls linux system built-in function to create pseudo-terminal, and linux system is created automatically
Build pseudo-terminal main equipment and pseudo-terminal slave device.
In practical applications, the standard output of application program is arranged to the pseudo-terminal slave device, Linux pseudo-terminals
Automatically the output in slave device is passed into main equipment, redirector is circulated from pseudo-terminal master by read or similar built-in functions
Equipment reads the output of application program, is then exported by write or similar built-in functions by the redirection for printing to acquiescence is exported
In equipment.
In practical applications, redirector is read from pseudo-terminal main equipment by read or similar built-in function circulations and applied
The output of program, then will export the redirection output equipment for printing to configuration interface and specifying by write or similar built-in functions
On.
In practical applications, this method includes the main equipment and slave device that redirector creates Linux pseudo-terminals, uses
Pseudo-terminal main equipment starts application program as standard output, in program operation process, redirector from pseudo-terminal from
The output of application program is read in equipment, then prints to output on other output equipments.
The method for realizing re-direction applications program standard output control in the invention is employed, application can not changed
In the case of program code, redirection or the duplication of application program standard output are realized, and support real-time at the same time in multiple terminals
Show the output of application program.Can also be during application program be run, switching at runtime redirects output equipment, improves
The flexibility of Linux embedded devices debugging, it is simpler reliable.
In this description, the present invention is described with reference to its specific embodiment.But it is clear that it can still make
Various modifications and alterations are without departing from the spirit and scope of the present invention.Therefore, specification and drawings are considered as illustrative
It is and nonrestrictive.
Claims (5)
- A kind of 1. method for realizing re-direction applications program standard output control, it is characterised in that the method includes following Step:(1) redirector is called, and path and the operating parameter of application program to be redirected are specified by command line parameter;(2) Linux pseudo-terminals are created;(3) application program is started;(4) output of application program is read from the Linux pseudo-terminals;(5) output of the application program described in redirector printing described in.
- 2. the method according to claim 1 for realizing re-direction applications program standard output control, it is characterised in that described The step of (2) in, the Linux pseudo-terminals include pseudo-terminal main equipment and pseudo-terminal slave device.
- 3. the method according to claim 2 for realizing re-direction applications program standard output control, it is characterised in that described The step of (3) comprise the following steps:(3.1) redirector described in calls the subprocess of the application program described in fork function creations;(3.2) redirector described in calls dup2 functions that the standard output of the application program is arranged to the puppet Terminal slave device;(3.3) according to the path of the application program and operating parameter, exec functions are called to start the application program.
- 4. the method according to claim 1 for realizing re-direction applications program standard output control, it is characterised in that described The step of (5) include following two parallel steps:(5.1) output of the application program is printed into the redirection output equipment of acquiescence;(5.2) output of the application program is printed into standard output device.
- 5. the method according to claim 1 for realizing re-direction applications program standard output control, it is characterised in that described The step of (5) in, the redirector, which provides, redirects output equipment configuration interface, and the redirector passes through institute The configuration interface stated specifies new redirection output equipment.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711290807.3A CN107908576A (en) | 2017-12-08 | 2017-12-08 | The method for realizing re-direction applications program standard output control |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711290807.3A CN107908576A (en) | 2017-12-08 | 2017-12-08 | The method for realizing re-direction applications program standard output control |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107908576A true CN107908576A (en) | 2018-04-13 |
Family
ID=61854802
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711290807.3A Pending CN107908576A (en) | 2017-12-08 | 2017-12-08 | The method for realizing re-direction applications program standard output control |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107908576A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020114217A1 (en) * | 2018-12-05 | 2020-06-11 | 中兴通讯股份有限公司 | Process debugging method and apparatus, and storage medium |
CN111399949A (en) * | 2020-04-02 | 2020-07-10 | 马瑞利汽车电子(广州)有限公司 | Method for starting background debugging function of automobile instrument |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1411238A (en) * | 2002-05-31 | 2003-04-16 | 华为技术有限公司 | Method of realizing communication equipment output reorientation |
CN1925666A (en) * | 2006-09-30 | 2007-03-07 | 华为技术有限公司 | Device and method for realizing reorienting of veneer equipment serial port |
CN103677820A (en) * | 2013-12-05 | 2014-03-26 | 上海斐讯数据通信技术有限公司 | Embedded development software output method and system |
US8782642B2 (en) * | 2005-03-15 | 2014-07-15 | Solarflare Communications, Inc. | Data processing system with data transmit capability |
US8898638B1 (en) * | 2003-06-27 | 2014-11-25 | American Megatrends, Inc. | Method and system for remote software debugging |
CN105278927A (en) * | 2014-06-11 | 2016-01-27 | 中兴通讯股份有限公司 | Printing message obtaining method and printing message obtaining device |
CN107908575A (en) * | 2017-12-05 | 2018-04-13 | 国网安徽省电力有限公司电力科学研究院 | Substation powered fortune checking device compatibility interface adapting appts and method in real time |
-
2017
- 2017-12-08 CN CN201711290807.3A patent/CN107908576A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1411238A (en) * | 2002-05-31 | 2003-04-16 | 华为技术有限公司 | Method of realizing communication equipment output reorientation |
US8898638B1 (en) * | 2003-06-27 | 2014-11-25 | American Megatrends, Inc. | Method and system for remote software debugging |
US8782642B2 (en) * | 2005-03-15 | 2014-07-15 | Solarflare Communications, Inc. | Data processing system with data transmit capability |
CN1925666A (en) * | 2006-09-30 | 2007-03-07 | 华为技术有限公司 | Device and method for realizing reorienting of veneer equipment serial port |
CN103677820A (en) * | 2013-12-05 | 2014-03-26 | 上海斐讯数据通信技术有限公司 | Embedded development software output method and system |
CN105278927A (en) * | 2014-06-11 | 2016-01-27 | 中兴通讯股份有限公司 | Printing message obtaining method and printing message obtaining device |
CN107908575A (en) * | 2017-12-05 | 2018-04-13 | 国网安徽省电力有限公司电力科学研究院 | Substation powered fortune checking device compatibility interface adapting appts and method in real time |
Non-Patent Citations (1)
Title |
---|
苏开红等: "基于WebServer的Linux远程登录系统的设计与实现", 《电脑知识与技术》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020114217A1 (en) * | 2018-12-05 | 2020-06-11 | 中兴通讯股份有限公司 | Process debugging method and apparatus, and storage medium |
CN111274122A (en) * | 2018-12-05 | 2020-06-12 | 中兴通讯股份有限公司 | Method, device and storage medium for debugging process |
CN111399949A (en) * | 2020-04-02 | 2020-07-10 | 马瑞利汽车电子(广州)有限公司 | Method for starting background debugging function of automobile instrument |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8060677B2 (en) | Real-time industrial ethernet ethercat communication control | |
US20180081682A1 (en) | Application development platform | |
US20180365035A1 (en) | Method for starting embedded apparatus, and apparatus | |
CN106250104B (en) | A kind of remote operating system for server, method and device | |
CN102087594B (en) | Management method and device for extension point and plugins | |
CN107908576A (en) | The method for realizing re-direction applications program standard output control | |
CN106528184A (en) | App development method based on cordova platform | |
CN104461516A (en) | Data processing method and device | |
Yamanoue et al. | A m2m system using arduino, android and wiki software | |
JP6195465B2 (en) | Remote card content management using synchronous server-side scripting | |
CN103676911A (en) | Equipment control system and control method | |
CN106980531A (en) | Input method operation processing method and device | |
CN109032705A (en) | Execution method, apparatus, electronic equipment and the readable storage medium storing program for executing of application program | |
CN113902387A (en) | Workflow processing method and device and electronic equipment | |
CN107291637A (en) | The method and apparatus of compatible polytypic mobile communication module in Android system | |
CN105320081A (en) | IOT equipment unified control and management method based on two-dimensional code | |
CN103475705A (en) | System and method for elevator self-study and smart phone | |
JP3979998B2 (en) | VLIW processor with data spinning means | |
TWI417788B (en) | A data processing system and a method of operating a rendering platform | |
CN109937404B (en) | Method and system for real-time data exchange between program modules | |
CN103677718A (en) | Spliced wall control method and terminal | |
CN109783505A (en) | The method and system and medium evaluated offline are realized using visual control | |
CN109144491A (en) | Microcomputer development platform | |
CN109460280A (en) | Run method, the terminal of program | |
CN105511910A (en) | Interface configuration method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180413 |