diff options
Diffstat (limited to 'libdivecomputer.c')
-rw-r--r-- | libdivecomputer.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c index 24f4d0ff5..e308c132d 100644 --- a/libdivecomputer.c +++ b/libdivecomputer.c @@ -923,14 +923,30 @@ const char *do_libdivecomputer_import(device_data_t *data) } err = translate("gettextFromC", "Unable to open %s %s (%s)"); - rc = dc_device_open(&data->device, data->context, data->descriptor, data->devname); + + if (data->bluetooth_mode) { + dc_serial_t *serial_device; + + rc = dc_serial_qt_open(&serial_device, data->context, data->devname); + if (rc == DC_STATUS_SUCCESS) { + rc = dc_device_custom_open(&data->device, data->context, data->descriptor, serial_device); + } else { + report_error(errmsg(rc)); + } + + } else { + rc = dc_device_open(&data->device, data->context, data->descriptor, data->devname); + + if (rc != DC_STATUS_SUCCESS && subsurface_access(data->devname, R_OK | W_OK) != 0) + err = translate("gettextFromC", "Insufficient privileges to open the device %s %s (%s)"); + } + if (rc == DC_STATUS_SUCCESS) { err = do_device_import(data); /* TODO: Show the logfile to the user on error. */ dc_device_close(data->device); data->device = NULL; - } else if (subsurface_access(data->devname, R_OK | W_OK) != 0) - err = translate("gettextFromC", "Insufficient privileges to open the device %s %s (%s)"); + } dc_context_free(data->context); data->context = NULL; |