[PATCH 12/12] parse divecomputer model nickname/firmware/serial information

Linus Torvalds torvalds at linux-foundation.org
Sun Mar 9 20:55:29 PDT 2014


On Sun, Mar 9, 2014 at 8:24 PM, Dirk Hohndel <dirk at hohndel.org> wrote:
>
> I get "Unmatched action 'salinity'" when reading back the data I write
> out...

Ahh, an example of something I don't have in my dives.

Does this trivial patch fix it for you? Add my sign-off and the
trivial explanation if it passes  your testing..

          Linus
-------------- next part --------------
 load-git.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/load-git.c b/load-git.c
index abdf135e0364..33e282b182b8 100644
--- a/load-git.c
+++ b/load-git.c
@@ -79,6 +79,11 @@ static pressure_t get_pressure(const char *line)
 	return p;
 }
 
+static int get_salinity(const char *line)
+{
+	return rint(10*ascii_strtod(line, NULL));
+}
+
 static fraction_t get_fraction(const char *line)
 {
 	fraction_t f;
@@ -494,6 +499,9 @@ static void parse_dc_model(char *line, struct membuffer *str, void *_dc)
 static void parse_dc_surfacepressure(char *line, struct membuffer *str, void *_dc)
 { struct divecomputer *dc = _dc; dc->surface_pressure = get_pressure(line); }
 
+static void parse_dc_salinity(char *line, struct membuffer *str, void *_dc)
+{ struct divecomputer *dc = _dc; dc->salinity = get_salinity(line); }
+
 static void parse_dc_surfacetime(char *line, struct membuffer *str, void *_dc)
 { struct divecomputer *dc = _dc; dc->surfacetime = get_duration(line); }
 
@@ -647,7 +655,7 @@ struct keyword_action dc_action[] = {
 #undef D
 #define D(x) { #x, parse_dc_ ## x }
 	D(airtemp), D(date), D(deviceid), D(diveid), D(duration),
-	D(event), D(maxdepth), D(meandepth), D(model),
+	D(event), D(maxdepth), D(meandepth), D(model), D(salinity),
 	D(surfacepressure), D(surfacetime), D(time), D(watertemp),
 };
 


More information about the subsurface mailing list