From 0cdb02a43986b5b679d651554787a63a2e1b92c0 Mon Sep 17 00:00:00 2001 From: aap Date: Fri, 4 Nov 2016 14:50:02 +0100 Subject: [PATCH] little fix in apr; added delay to mkpty --- misc/mkpty.c | 10 +++++++++- src/apr.c | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/misc/mkpty.c b/misc/mkpty.c index 3c1b63d..015a625 100644 --- a/misc/mkpty.c +++ b/misc/mkpty.c @@ -12,6 +12,7 @@ #include #include #include +#include struct termios tiosaved; @@ -33,6 +34,10 @@ reset(int fd) return 0; } +#define BAUD 30 + +struct timespec slp = { 0, 1000*1000*1000 / BAUD }; + void readwrite(int ttyin, int ttyout, int ptyin, int ptyout) { @@ -56,8 +61,10 @@ readwrite(int ttyin, int ttyout, int ptyin, int ptyout) if(pfd[0].revents & POLLIN){ if(n = read(ptyin, &c, 1), n <= 0) return; - else + else{ write(ttyout, &c, 1); + nanosleep(&slp, NULL); + } } /* read from tty, write to pty */ if(pfd[1].revents & POLLIN){ @@ -67,6 +74,7 @@ readwrite(int ttyin, int ttyout, int ptyin, int ptyout) if(c == 035) return; write(ptyout, &c, 1); + nanosleep(&slp, NULL); } } } diff --git a/src/apr.c b/src/apr.c index 42f4580..2f87655 100644 --- a/src/apr.c +++ b/src/apr.c @@ -2410,7 +2410,7 @@ pulse(et1){ apr->mb &= RT; // 6-3 } if(apr->ir_jrst && apr->ir & H12) - apr->ex_mode_sync = 1; // 5-13 + set_ex_mode_sync(apr, 1); // 5-13 if(apr->ir_jrst && apr->ir & H11) ar_flag_set(apr); // 6-10 if(PI_RST)