From 4ae3a4f3ab8b3b8a673b1a8637893b3ca45e8e62 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 21 Nov 2013 16:16:45 +0100 Subject: [PATCH] Remove the infinite timeout. An infinite timeout causes major problems, because if the device doesn't respond at all, the read call will block forever. With the eon serial line settings (1200 8N2), the total time to read the 2305 byte packet is about 21.129 seconds. A timeout of 30 seconds should be plenty of time. --- src/suunto_eon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/suunto_eon.c b/src/suunto_eon.c index 31a1eda..5cb2d51 100644 --- a/src/suunto_eon.c +++ b/src/suunto_eon.c @@ -104,8 +104,8 @@ suunto_eon_device_open (dc_device_t **out, dc_context_t *context, const char *na return DC_STATUS_IO; } - // Set the timeout for receiving data (1000ms). - if (serial_set_timeout (device->port, -1) == -1) { + // Set the timeout for receiving data (30s). + if (serial_set_timeout (device->port, 30000) == -1) { ERROR (context, "Failed to set the timeout."); serial_close (device->port); free (device);