diff options
| -rw-r--r-- | sercp.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -335,11 +335,16 @@ void FlushSerialPort() { len = (size_t) ulNumBytes; } while (len > 1); #else + // the port is blocking on __APPLE__ (see OpenUart): read without waiting, or this + // hangs until the other side sends something + int flags = fcntl(serial_fd, F_GETFL); + fcntl(serial_fd, F_SETFL, flags | O_NONBLOCK); tcflush(serial_fd, TCIOFLUSH); do { sleep_ms(100); len = read (serial_fd, p_buff, 100); } while (len > 1); + fcntl(serial_fd, F_SETFL, flags); #endif } if (is_osc_progress_supported) { |
