Expose FIT file parsing as its own "vendor"
Since we can now parse FIT files from other vendors than Garmin (ie the Suunto FIT file export), let's expose this as a generic "FIT file import" in the dive computer list. It's all still very much using the Garmin parser, but uses a model ID that is zero. The only difference that makes is that it also tells the parser to treat the result as a dive even if it cannot find the actual dive markers that Garmin uses, since those won't exist in the limited FIT file export. This is still somewhat inconvenient, in that you cannot point to the file itself, you can just point to the directory that contains FIT files. And right now we have an artifical length limitation on the filenames, but I'll fix that next. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
929ce47155
commit
67cd1cc0fd
@ -465,6 +465,7 @@ static const dc_descriptor_t g_descriptors[] = {
|
||||
/* for the Mk2 we are using the model of the global model - the APAC model is 3702 */
|
||||
{"Garmin", "Descent Mk1", DC_FAMILY_GARMIN, 2859, DC_TRANSPORT_USBSTORAGE, dc_filter_garmin},
|
||||
{"Garmin", "Descent Mk2/Mk2i", DC_FAMILY_GARMIN, 3258, DC_TRANSPORT_USBSTORAGE, dc_filter_garmin},
|
||||
{"FIT", "File import", DC_FAMILY_GARMIN, 0, DC_TRANSPORT_USBSTORAGE, NULL },
|
||||
};
|
||||
|
||||
static int
|
||||
|
||||
@ -52,6 +52,7 @@ typedef struct garmin_device_t {
|
||||
dc_device_t base;
|
||||
dc_iostream_t *iostream;
|
||||
unsigned char fingerprint[FIT_NAME_SIZE];
|
||||
unsigned int model;
|
||||
#ifdef HAVE_LIBMTP
|
||||
unsigned char use_mtp;
|
||||
LIBMTP_mtpdevice_t *mtp_device;
|
||||
@ -92,6 +93,7 @@ garmin_device_open (dc_device_t **out, dc_context_t *context, dc_iostream_t *ios
|
||||
// Set the default values.
|
||||
device->iostream = iostream;
|
||||
memset(device->fingerprint, 0, sizeof(device->fingerprint));
|
||||
device->model = model;
|
||||
|
||||
#ifdef HAVE_LIBMTP
|
||||
// for a Descent Mk2/Mk2i, we have to use MTP to access its storage;
|
||||
@ -564,7 +566,7 @@ garmin_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, void
|
||||
data = dc_buffer_get_data(file);
|
||||
size = dc_buffer_get_size(file);
|
||||
|
||||
is_dive = garmin_parser_is_dive(parser, data, size, devinfo_p);
|
||||
is_dive = !device->model || garmin_parser_is_dive(parser, data, size, devinfo_p);
|
||||
if (devinfo_p) {
|
||||
// first time we came through here, let's emit the
|
||||
// devinfo and vendor events
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user