From dc8f32609ec96a5dbdc7c4b29f7965e66de5707d Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 16 Jul 2023 10:02:53 -0700 Subject: [PATCH] garmin: add 'FIELD_DESCRIPTION' message definitions We don't use them, but they seem to be trying to describe what the developer fields are used for. We may now parse the developer fields enough to skip over them gracefully, but it looks like we migth some day want to _really_ parse them, and while I haven't figured it out (at all!) yet, this may some day help. For example, we get things like this: FIELD_DESCRIPTION_name (STRING): "Depth" FIELD_DESCRIPTION_unit (STRING): "feet" FIELD_DESCRIPTION_original_mesg (UINT16): 20 FIELD_DESCRIPTION_data_index (UINT8): 0 FIELD_DESCRIPTION_field_definition (UINT8): 0 FIELD_DESCRIPTION_base_type (UINT8): 136 which doesn't tell me anything at all right now, but looks like maybe it should some day. It looks like this is defining a developer field for depth in feet (duh), and the data format may be the same as a RECORD message (20), which does indeed normally contain the depth (but in mm as an UINT32, and it's field number 92, so..) End result: not useful right now, because I'm much too confused about it. But the debug printout looks interesting. Signed-off-by: Linus Torvalds --- src/garmin_parser.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/garmin_parser.c b/src/garmin_parser.c index 1e3fca5..4263d85 100644 --- a/src/garmin_parser.c +++ b/src/garmin_parser.c @@ -868,6 +868,17 @@ DECLARE_FIELD(EVENT, tank_pressure_reserve, UINT32Z) { } // sensor ID DECLARE_FIELD(EVENT, tank_pressure_critical, UINT32Z) { } // sensor ID DECLARE_FIELD(EVENT, tank_pressure_lost, UINT32Z) { } // sensor ID +// "Field description" (for developer fields) +DECLARE_FIELD(FIELD_DESCRIPTION, data_index, UINT8) { } +DECLARE_FIELD(FIELD_DESCRIPTION, field_definition, UINT8) { } +DECLARE_FIELD(FIELD_DESCRIPTION, base_type, UINT8) { } +DECLARE_FIELD(FIELD_DESCRIPTION, name, STRING) { } // "Depth" +DECLARE_FIELD(FIELD_DESCRIPTION, scale, UINT8) { } +DECLARE_FIELD(FIELD_DESCRIPTION, offset, SINT8) { } +DECLARE_FIELD(FIELD_DESCRIPTION, unit, STRING) { } // "feet" +DECLARE_FIELD(FIELD_DESCRIPTION, original_mesg, UINT16) { } +DECLARE_FIELD(FIELD_DESCRIPTION, original_field, UINT8) { } + struct msg_desc { unsigned char maxfield; const struct field_desc *field[]; @@ -1104,6 +1115,22 @@ DECLARE_MESG(TANK_SUMMARY) = { } }; +DECLARE_MESG(FIELD_DESCRIPTION) = { + .maxfield = 16, + .field = { + SET_FIELD(FIELD_DESCRIPTION, 0, data_index, UINT8), + SET_FIELD(FIELD_DESCRIPTION, 1, field_definition, UINT8), + SET_FIELD(FIELD_DESCRIPTION, 2, base_type, UINT8), + SET_FIELD(FIELD_DESCRIPTION, 3, name, STRING), // "Depth" + SET_FIELD(FIELD_DESCRIPTION, 6, scale, UINT8), + SET_FIELD(FIELD_DESCRIPTION, 7, offset, SINT8), + SET_FIELD(FIELD_DESCRIPTION, 8, unit, STRING), // "feet" + // Some kind of pointer to original field? + SET_FIELD(FIELD_DESCRIPTION, 14, original_mesg, UINT16), + SET_FIELD(FIELD_DESCRIPTION, 15, original_field, UINT8), + } +}; + // Unknown global message ID's.. DECLARE_MESG(WTF_13) = { }; DECLARE_MESG(WTF_22) = { }; @@ -1145,6 +1172,8 @@ static const struct { SET_MESG(147, SENSOR_PROFILE), + SET_MESG(206, FIELD_DESCRIPTION), + SET_MESG(216, WTF_216), SET_MESG(233, WTF_233), SET_MESG(258, DIVE_SETTINGS),