diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2018-04-19 02:10:29 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-04-27 11:52:48 -0700 |
commit | 0cacb06d8083e262263cd37fe856aaebab6cc059 (patch) | |
tree | 3daf2b6b900aef89ac470d13a36c536dad5b6678 /core | |
parent | 1dfac4cb74d883dda56d39be407e823be82ed96c (diff) | |
download | subsurface-0cacb06d8083e262263cd37fe856aaebab6cc059.tar.gz |
Use libdc information about supported transports
For example, even on platforms that support libusb, libdivecomputer
might be compiled without such support.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/downloadfromdcthread.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp index e67d71403..0cc5a204c 100644 --- a/core/downloadfromdcthread.cpp +++ b/core/downloadfromdcthread.cpp @@ -109,21 +109,20 @@ void fill_computer_list() dc_iterator_t *iterator = NULL; dc_descriptor_t *descriptor = NULL; - int transportMask = 0; + // start out with the list of transports that libdivecomputer claims to support + // dc_context_get_transports ignores its context argument... + int transportMask = dc_context_get_transports(NULL); + + // then add the ones that we have our own implementations for #if defined(BT_SUPPORT) transportMask |= DC_TRANSPORT_BLUETOOTH; #endif #if defined(BLE_SUPPORT) transportMask |= DC_TRANSPORT_BLE; #endif -#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) && !defined(Q_OS_MAC) - transportMask |= DC_TRANSPORT_IRDA; -#endif -#if !defined(Q_OS_IOS) - transportMask |= DC_TRANSPORT_USB | DC_TRANSPORT_USBHID; -#endif -#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) - transportMask |= DC_TRANSPORT_SERIAL; +#if defined(Q_OS_IOS) + // libdivecomputer always claims to support serial, but on iOS we actually don't support that + transportMask &= ~DC_TRANSPORT_SERIAL; #endif fill_supported_mobile_list(); |