From 3aa6f169642a7b6808c13cfcbd3d5fbe28508a76 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Wed, 3 Mar 2021 12:08:39 +0100 Subject: [PATCH] serial_unix: Split timeout in seconds and microseconds Macos exposed errors when tv_usec was > 1000000. --- src/platforms/pc/serial_unix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/platforms/pc/serial_unix.c b/src/platforms/pc/serial_unix.c index 11000351..96e2da92 100644 --- a/src/platforms/pc/serial_unix.c +++ b/src/platforms/pc/serial_unix.c @@ -190,7 +190,8 @@ int platform_buffer_read(uint8_t *data, int maxsize) c = data; tv.tv_sec = 0; - tv.tv_usec = 1000 * cortexm_wait_timeout; + tv.tv_sec = cortexm_wait_timeout / 1000 ; + tv.tv_usec = 1000 * (cortexm_wait_timeout % 1000); /* Look for start of response */ do {