Garmin: be more permissive about the activity type

We used to require that we have one of the documented dive types in the
'sub_sport' type field.  But apparently Garmin added a new type number
for CCR diving, so CCR dives weren't recognized at all.

Add the new CCR case, but also say that if we have seen a DIVE_SUMMARY
record with average depth information, we'll just assume it's a dive
even for unrecognized sub_sport numbers.

Reported-by: Thomas Jacob <opiffe@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2019-05-05 09:57:36 -07:00
parent 2971cc20ff
commit e650acc052

View File

@ -1253,7 +1253,22 @@ garmin_parser_is_dive (dc_parser_t *abstract, const unsigned char *data, unsigne
devinfo_p->serial = garmin->cache.serial;
devinfo_p->model = garmin->cache.product;
}
return garmin->cache.sub_sport >= 53 && garmin->cache.sub_sport <= 57;
switch (garmin->cache.sub_sport) {
case 53: // Single-gas
case 54: // Multi-gas
case 55: // Gauge
case 56: // Apnea
case 57: // Apnea Hunt
case 63: // CCR
return 1;
default:
// Even if we don't recognize the sub_sport,
// let's assume it's a dive if we've seen
// average depth in the DIVE_SUMMARY record.
if (garmin->cache.AVGDEPTH)
return 1;
return 0;
}
}
static dc_status_t