From 5377706aca5f46fc2fb3d2bbd2e4780402742727 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Thu, 21 Jun 2018 16:01:10 +0900 Subject: FTDI support: try ftdi_open first if the device name is 'ftdi' It makes no sense to have the OS try (and fail) to open that device name. Signed-off-by: Dirk Hohndel --- core/libdivecomputer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c index 4d5b278a5..9a5b30087 100644 --- a/core/libdivecomputer.c +++ b/core/libdivecomputer.c @@ -1308,10 +1308,6 @@ dc_status_t divecomputer_device_open(device_data_t *data) return DC_STATUS_SUCCESS; if (transports & DC_TRANSPORT_SERIAL) { - rc = dc_serial_open(&data->iostream, context, data->devname); - if (rc == DC_STATUS_SUCCESS) - return rc; - #ifdef SERIAL_FTDI if (!strcmp(data->devname, "ftdi")) { rc = ftdi_open(&data->iostream, context); @@ -1319,6 +1315,10 @@ dc_status_t divecomputer_device_open(device_data_t *data) return rc; } #endif + rc = dc_serial_open(&data->iostream, context, data->devname); + if (rc == DC_STATUS_SUCCESS) + return rc; + } if (transports & DC_TRANSPORT_IRDA) { -- cgit v1.2.3-70-g09d2