# HG changeset patch # User Mychaela Falconia # Date 1730095324 0 # Node ID 62579cfff4fc72c16d22f892b22e837c87fbc4f0 # Parent ee14dd81bba1416dcd5d92da27d3a2c043f3f7dd fc-mcsi-rxtx: more proper integration with ttyhacks diff -r ee14dd81bba1 -r 62579cfff4fc sw/mcsi-rxtx/mainloop.c --- a/sw/mcsi-rxtx/mainloop.c Mon Oct 28 01:45:32 2024 +0000 +++ b/sw/mcsi-rxtx/mainloop.c Mon Oct 28 06:02:04 2024 +0000 @@ -12,13 +12,15 @@ extern int target_fd; +int is_active; + main_loop() { fd_set fds; struct timeval tv; u_char buf[320]; unsigned off; - int cc, is_active; + int cc; is_active = 0; off = 0; @@ -35,12 +37,15 @@ if (cc < 0) { if (errno == EINTR) continue; + tty_cleanup(); perror("select"); exit(1); } if (cc == 0) { is_active = 0; - printf("Rx stream stopped, buffer dribble = %u\n", off); + sprintf(buf, "Rx stream stopped, buffer dribble = %u", + off); + async_msg_output(buf); off = 0; continue; } @@ -49,15 +54,17 @@ if (FD_ISSET(target_fd, &fds)) { cc = read(target_fd, buf + off, sizeof(buf) - off); if (cc < 0) { + tty_cleanup(); perror("serial port read"); exit(1); } if (cc == 0) { + tty_cleanup(); fprintf(stderr, "read EOF from serial port\n"); exit(1); } if (!is_active) { - printf("Rx stream started\n"); + async_msg_output("Rx stream started"); is_active = 1; } off += cc; @@ -66,5 +73,6 @@ off = 0; } } + fflush(stdout); } } diff -r ee14dd81bba1 -r 62579cfff4fc sw/mcsi-rxtx/rx_samples.c --- a/sw/mcsi-rxtx/rx_samples.c Mon Oct 28 01:45:32 2024 +0000 +++ b/sw/mcsi-rxtx/rx_samples.c Mon Oct 28 06:02:04 2024 +0000 @@ -5,8 +5,11 @@ #include #include +extern int is_active; + u_short rx_pcm_samples[160]; +void process_rx_block(buf) u_char *buf; {