It turns out that it's fairly common that people pass in the wrong
directory for the Garmin downloader, and we then just silently fail to
parse any dives because we don't find anything. The resulting logs
don't make it obvious what went wrong.
So add some informational messages about what directory we actually
tried to open, and what files we've found (and why we possibly ignored
them).
We already had this for some cases (like "This doesn't look lik ea dive
file"), but not for the more fundamental issues of not finding files to
begin with.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Primoz seems to have problems downloading dives from the Garmin Descent,
even when the same files work fine for me. I suspect it's some Windows
issue, and the primary suspect would be the usual CR/LF text conversion.
Using O_BINARY would seem to be the obviously correct thing to do, and
won't hurt.
Reported-by: Primoz P <primozicp@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
When on the actual watch, the filename format for the FIT files ends up
being something like
2018-09-21-10-23-36.fit
but then if you download the activity from the Garmin Connect activity
website, it might show up as a ZIP file that contains a file named
something like
3030954326.fit
instead.
In order to make it easy to import these fit files that have been
downloaded from the Garmin cloud, relax the filename rules a bit.
NOTE! You still need to have the proper directory structure, and put
your FIT files in a subdirectory like
<some path>/Garmin/Activity/
to match the way the FIT files show up when you mount the Garmin Descent
locally. You can then point subsurface to <some path> when you do a
"download" from the Garmin Descent, regardless of whether it's an actual
case of the dive computer being mounted, or if you've downloaded the FIT
files to your local filesystem.
Reported-by: Andrew Trevor-Jones <atj777atj777@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
A typical FIT file contains several DEVICE_INFO messages. We need to
identify the one(s) for the creator (i.e. the actual device, not a
sub-component).
Note, Garmin identifies the Descent Mk1 as product 2859. I think we
should use this as the model number (instead of currently using 0.
Also, the vendor event is not to send the vendor name of the device, but
in order to send vendor specific events :-)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Dives are identified by a sub_sport range of 53-57 in the SPORT message.
This means that we need to parse the files before we actually offer them to the
application, which means we parse them three times all together, but I don't
see a way around that. Thankfully parsing a memory buffer is reasonably fast.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The libdivecomputer model is just broken - we don't know this
information before parsing the dive. But let's not emit a fake event
that generates bogus serial number data. I thought I'd be able to fill
it in, but this really isn't reasonable, so disable it entirely for now.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This is _very_ incomplete. The FIT file is really fairly generic, but
this has the basics for parsing, with tables to look up the low-level
parsers by the FIT "message ID" and "field nr".
It doesn't actually parse anything yet, so consider this a FIT decoder
skeleton.
Right now it basically prints out the different record values, and names
then for the (few) cases where I've found or guessed the numbers.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
It's really just reading files from storage, but with the proper sorting
and fingerprint handling.
The Garmin back-end does no actual parsing yet, so the end result is
garbage, but now the data has technically been downloaded. Without the
parser, I haven't actually verified that any of it is remotely correct,
but it all looks good.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This does absolutely nothing, but it adds the basic skeleton for a new
dive computer support.
Not only don't I have any real code for any of this yet, but I actually
think it might be useful to have a "this is how to add a new dive
computer" example commit.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>