summaryrefslogtreecommitdiffstats
path: root/core/libdivecomputer.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-25 15:22:21 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-27 11:52:48 -0700
commit5faa167e9fdab0e0c9b1a24346440c3006659c66 (patch)
tree399db1d8b1a67d29b80a02e562cf0958a77c3a22 /core/libdivecomputer.c
parentea7a7c6b24c749491ee56f99cad118cd4bc7aac7 (diff)
downloadsubsurface-5faa167e9fdab0e0c9b1a24346440c3006659c66.tar.gz
libdc transport debugging
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/libdivecomputer.c')
-rw-r--r--core/libdivecomputer.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index 577e8a7a3..169d6176b 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -1200,6 +1200,28 @@ void logfunc(dc_context_t *context, dc_loglevel_t loglevel, const char *file, un
}
}
+char *transport_string[] = {
+ "SERIAL",
+ "USB",
+ "USBHID",
+ "IRDA",
+ "BT",
+ "BLE"
+};
+
+static char *transport_to_string(int t)
+{
+ static char buf[1024];
+ buf[0] = '\0';
+ for (int i = 0; i < 6; i++) {
+ if (t & (1<<i)) {
+ strncat(buf, transport_string[i], 1024);
+ strncat(buf, " ", 1024);
+ }
+ }
+ return buf;
+}
+
/*
* Get the transports supported by us (as opposed to
* the list of transports supported by a particular
@@ -1221,11 +1243,11 @@ static unsigned int get_supported_transports(device_data_t *data)
if (!strncmp(data->devname, "LE:", 3))
supported = DC_TRANSPORT_BLE;
}
-
+ report_error("get_supported_transports returns");
+ report_error(transport_to_string(supported));
return supported;
}
-
dc_status_t divecomputer_device_open(device_data_t *data)
{
dc_status_t rc;
@@ -1234,6 +1256,8 @@ dc_status_t divecomputer_device_open(device_data_t *data)
unsigned int transports, supported;
transports = dc_descriptor_get_transports(descriptor);
+ report_error("dc_descriptor_get_transports");
+ report_error(transport_to_string(transports));
supported = get_supported_transports(data);
transports &= supported;