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.
This commit is contained in:
parent
914e740087
commit
4ae3a4f3ab
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user