Skip to content

Commit 5796ea1

Browse files
committed
Fixed keep-alive signalling for pronterface. This time it's better tested!
1 parent 04567c1 commit 5796ea1

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

comm.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ static void* comm_thread( void* arg)
6262
int eof_on_input = 0;
6363
char pending_input;
6464
char pending_output;
65+
int prescaler = 0;
6566
/*
6667
* The data from the stdout pipe does not become available until
6768
* stdout is flushed. So the timer is set to a short cycle that
6869
* flushes stdout with each timeout.
6970
*/
7071
while (1) {
71-
int prescaler = 0;
7272
/* wait for event */
7373
int rc = poll( fds, (eof_on_input) ? 2 : 4, timeout);
7474
#if LL_DEBUG
@@ -83,10 +83,8 @@ static void* comm_thread( void* arg)
8383
} else if (rc == 0 || (rc < 0 && errno == EINTR)) {
8484
// timeout, send dummy character to keep connection alive
8585
if (++prescaler > keep_alive_timeout / timeout) {
86-
printf( "%c", 0);
87-
if (DEBUG_COMM && (debug_flags & DEBUG_COMM)) {
88-
fprintf( stderr, "<KEEP ALIVE SENT>");
89-
}
86+
printf( "%c", 10); // only safe code for pronterface !
87+
fprintf( stderr, "<KEEP ALIVE SENT>");
9088
prescaler = 0;
9189
}
9290
#if LL_DEBUG

0 commit comments

Comments
 (0)