From 9554e87431e275a53f1a7ae083468dd2aea29d1a Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 30 Oct 2020 10:00:29 -0700 Subject: [PATCH] Garmin: support .FIT files from filesystem even for MTP devices If the caller provides us with a path name, we should not try to connect to the dive computer via MTP, but instead read the .FIT files from the path provided. Signed-off-by: Dirk Hohndel --- src/garmin.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/garmin.c b/src/garmin.c index 444dabf..029f1d5 100644 --- a/src/garmin.c +++ b/src/garmin.c @@ -414,6 +414,12 @@ garmin_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, void return rc; pathname[pathlen] = 0; +#ifdef HAVE_LIBMTP + // if the user passes in a path, don't try to read via MTP + if (pathlen) + device->use_mtp = 0; +#endif + // The actual dives are under the "Garmin/Activity/" directory // as FIT files, with names like "2018-08-20-10-23-30.fit". // Make sure our buffer is big enough.