Older Cochran Log Formats
Hi, I have access to sample files from older Cochran Analyst software. Has anyone asked about importing older cochran WAN files? -- John Van Ostrand At large on sabbatical ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Patches to add basic support for the Suunto EON Steel
Ok, I re-organized my patches a bit, and here are four patches to support the basic dive log download of the new Suunto EON Steel dive computer. I combined some of my basic support patches into one, since I didn't feel like I needed to show the odd history of having implemented some things in stages (ie the second attachment was originally four patches that didn't do anything useful unless combined).. Three of the patches are for libdivecomputer: - patch 1/3: the preparatory parser support patch - patch 2/3: the basic core dive data downloader for the EON Steel - patch 3/3: the small addition to parse more than the basic data Patch 2/3 works on its own, but means that you *just* get the core dive data (with full dive profiles and cylinder pressures). Patch 3/3 gives you the serial number and firmware version etc, but that relies on 1/3. The fourth patch (1/1) is the patch to subsurface to actually use the new parser support in libdivecomputer, so that you can get the EON Steel serial numbers etc. This makes your Suunto EON Steel quite usable with subsurface. There is more we could do, but it's all fairly secondary stuff. I'd like to get this all accepted before I even bother starting to look at the other things I can do with the dive computer. Of course, since apparently the EON Steel won't really be *available* until Nov 15th or so, right now these patches are useful mainly to people with preproduction models like me. But wouldn't it be nice if we could just say that we support the thing before it's even available for sale? Linus From a710c94e9ed0a8cda13fd3f12533493443cc8374 Mon Sep 17 00:00:00 2001 From: Linus Torvalds torva...@linux-foundation.org Date: Wed, 22 Oct 2014 11:23:09 -0700 Subject: [PATCH 1/3] parser: add DC_FIELD_DEVINFO field type for parse-time device information This can be used to extend and override the device open-time DEVINFO callback information at dive parse time. If you leave the pointers NULL, nothing happens, but you can choose to individually fill in the fields as needed (or not). NOTE: The caller is supposed to clear the structure so that the divecomputer backends don't need to care about fields they don't support. So it's valid for a backend to just return DC_STATUS_SUCCESS and not do anything else as a reply to DC_FIELD_DEVINFO, although obviously that means that you won't be returning any new information either. Signed-off-by: Linus Torvalds torva...@linux-foundation.org --- include/libdivecomputer/parser.h | 17 - 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/include/libdivecomputer/parser.h b/include/libdivecomputer/parser.h index 65b18c9bb2fe..741803f4e256 100644 --- a/include/libdivecomputer/parser.h +++ b/include/libdivecomputer/parser.h @@ -53,9 +53,13 @@ typedef enum dc_field_type_t { DC_FIELD_GASMIX_COUNT, DC_FIELD_GASMIX, DC_FIELD_SALINITY, - DC_FIELD_ATMOSPHERIC + DC_FIELD_ATMOSPHERIC, + DC_FIELD_DEVINFO, } dc_field_type_t; +// Make it easy to test support compile-time with #ifdef DC_FIELD_DEVINFO +#define DC_FIELD_DEVINFO DC_FIELD_DEVINFO + typedef enum parser_sample_event_t { SAMPLE_EVENT_NONE, SAMPLE_EVENT_DECOSTOP, @@ -128,6 +132,17 @@ typedef struct dc_gasmix_t { double nitrogen; } dc_gasmix_t; +// You don't have to fill all of these in, you can leave them NULL +// but if you do fill them in, they override the device devinfo +typedef struct dc_field_devinfo_t { + const char *vendor; + const char *model; + const char *serial; + const char *hw_version; + const char *fw_version; + const char *dive_id; +} dc_field_devinfo_t; + typedef union dc_sample_value_t { unsigned int time; double depth; -- 2.1.2.452.gd5ca7ae From 4171019d9c64af2d54d0c75eff7144eb94fd6cf1 Mon Sep 17 00:00:00 2001 From: Linus Torvalds torva...@linux-foundation.org Date: Mon, 20 Oct 2014 10:34:37 -0700 Subject: [PATCH 2/3] Suunto EON Steel: support downloading of core dive profile data Very roughly copied from my test application. This parses all the basic dive data, including sample data (time, depth, cylinder pressure etc). We don't really report events yet, though. This includes data that the EON steel considers samples, but that libdivecomputer considers events. So while some of the sample information is parsed (like NDL, ceiling and TTS information), this doesn't generate the libdivecomputer events to make the information available to applications yet. Signed-off-by: Linus Torvalds torva...@linux-foundation.org --- examples/universal.c | 1 + include/libdivecomputer/common.h | 1 + include/libdivecomputer/suunto.h | 1 + include/libdivecomputer/suunto_eon_steel.h | 39 ++ msvc/libdivecomputer.vcproj| 8 + src/Makefile.am| 1 + src/descriptor.c | 6 + src/device.c | 3 + src/parser.c | 3 +
Re: [PATCH] parser: add DC_FIELD_DEVINFO field type for parse-time device information
From: Linus Torvalds torva...@linux-foundation.org Date: Wed, 22 Oct 2014 12:11:12 -0700 Subject: [PATCH] Use the new DC_FIELD_DEVINFO callback if it exists This gets dive ID and divecomputer device information in a sane string format. Signed-off-by: Linus Torvalds torva...@linux-foundation.org --- Jef and the libdivecomputer mailing list cc'd, because this whole patch to subsurface only makes sense if the libdivecomputer part of it gets applied. So I'm sending this out not to be applied by Dirk, but to show how simple the new DC_FIELD_DEVINFO model is to use, and how subsurface can trivially use it. With this patch, my Suunto EON Steel backend to liobdivecomputer just works. Even without this patch it worked for getting dives and profiles, but this is the part that is needed to actually get dive computer serial numbers etc. Also notice how this can actually work *together* with the old DC_EVENT_DEVINFO interface. In particular, say that you have an old backend that used the DC_EVENT_DEVINFO interface, but wants to give a *real* serial number, not the broken numeric-only one that DC_EVENT_DEVINFO supports. Such a backend could just add the new DC_FIELD_DEVINFO support, and subsurface will continue to use the old deviceid that was generated by DC_EVENT_DEVINFO - so that device ID's don't change in your logbook - but can automatically now pick up properly formatted serial numbers (of hardware versions etc). And it would just work. The point being that this doesn't break the old interface, and it's actually designed to work in conjunction with it. It's also designed so that applications that haven't been changed (including versions of subsurface that do not have this patch) to use the new DC_FIELD_DEVINFO interface won't even notice. They'll get all the old information, and they aren't broken by any of this. They can't take advantage of the new info, and they won't get EON Steel serial numbers etc, but they'll work fine. libdivecomputer.c | 30 ++ 1 file changed, 30 insertions(+) diff --git a/libdivecomputer.c b/libdivecomputer.c index ff8d0eb93bda..5da49577ba2c 100644 --- a/libdivecomputer.c +++ b/libdivecomputer.c @@ -397,6 +397,28 @@ static uint32_t calculate_diveid(const unsigned char *fingerprint, unsigned int return csum[0]; } +static uint32_t calculate_string_hash(const char *str) +{ + return calculate_diveid(str, strlen(str)); +} + +static void parse_devinfo(struct dive *dive, dc_field_devinfo_t *info) +{ + // Our dive ID is the string hash of the dive_id string + if (info-dive_id !dive-dc.diveid) + dive-dc.diveid = calculate_string_hash(info-dive_id); + + // Our device ID is the string hash of the serial number + if (info-serial !dive-dc.deviceid) + dive-dc.deviceid = calculate_string_hash(info-serial); + + // If we have a deviceid either from the above or from the + // original DC_EVENT_DEVINFO, and we now have serial numbers + // or fw/hw versions, fill that into the device node + if (dive-dc.deviceid (info-serial || info-fw_version)) + create_device_node(dive-dc.model, dive-dc.deviceid, info-serial, info-fw_version, ); +} + /* returns true if we want libdivecomputer's dc_device_foreach() to continue, * false otherwise */ static int dive_cb(const unsigned char *data, unsigned int size, @@ -494,6 +516,14 @@ static int dive_cb(const unsigned char *data, unsigned int size, dive-dc.surface_pressure.mbar = rint(surface_pressure * 1000.0); #endif +#ifdef DC_FIELD_DEVINFO + // The dive parsing may give us more device information + dc_field_devinfo_t devinfo = { NULL }; + rc = dc_parser_get_field(parser, DC_FIELD_DEVINFO, 0, devinfo); + if (rc == DC_STATUS_SUCCESS) + parse_devinfo(dive, devinfo); +#endif + rc = parse_gasmixes(devdata, dive, parser, ngases, data); if (rc != DC_STATUS_SUCCESS) { dev_info(devdata, translate(gettextFromC, Error parsing the gas mix)); -- 2.1.2.452.gd5ca7ae ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
[PATCH 8/9] profile.c: remove a variable which is set but not used
From: Lubomir I. Ivanov neolit...@gmail.com fill_o2_values(): struct gas_pressures *pressures; Signed-off-by: Lubomir I. Ivanov neolit...@gmail.com --- profile.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/profile.c b/profile.c index bea556f..f0b7041 100644 --- a/profile.c +++ b/profile.c @@ -924,11 +924,9 @@ void fill_o2_values(struct divecomputer *dc, struct plot_info *pi, struct dive * { int i, j; double last_setpoint, last_sensor[3], o2pressure, amb_pressure; - struct gas_pressures *pressures; for (i = 0; i pi-nr; i++) { struct plot_data *entry = pi-entry + i; - pressures = (entry-pressures); // For 1st iteration, initialise the last_ values if (dc-dctype == CCR) { if (i == 0) { -- 1.7.11.msysgit.0 ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
[PATCH 7/9] profile.c: remove unused variables in calculate_ccr_po2()
From: Lubomir I. Ivanov neolit...@gmail.com Signed-off-by: Lubomir I. Ivanov neolit...@gmail.com --- profile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/profile.c b/profile.c index d64d1c7..bea556f 100644 --- a/profile.c +++ b/profile.c @@ -833,9 +833,9 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru * there are and the differences among the readings from these sensors. */ double calculate_ccr_po2(struct plot_data *entry, struct divecomputer *dc) { - double sump = 0.0, midp, minp = 999.9, maxp = -999.9; + double sump = 0.0, minp = 999.9, maxp = -999.9; double diff_limit = 100; // The limit beyond which O2 sensor differences are considered significant (default = 100 mbar) - int i, j, np = 0; + int i, np = 0; for (i=0; i dc-no_o2sensors; i++) if (entry-o2sensor[i]) { // Valid reading -- 1.7.11.msysgit.0 ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
[PATCH 5/9] divelogexportdialog.cpp: attempt to fix a 'unsigned / signed' warning
From: Lubomir I. Ivanov neolit...@gmail.com duration_t holds unsinged values, offset_t holds signed values. Signed-off-by: Lubomir I. Ivanov neolit...@gmail.com --- not sure about this one... can a picture offset be negative anyhow? --- qt-ui/divelogexportdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qt-ui/divelogexportdialog.cpp b/qt-ui/divelogexportdialog.cpp index 4e00b4e..557fa83 100644 --- a/qt-ui/divelogexportdialog.cpp +++ b/qt-ui/divelogexportdialog.cpp @@ -334,7 +334,7 @@ void DiveLogExportDialog::export_depths(const char *filename, const bool selecte int n = dive-dc.samples; struct sample *s = dive-dc.sample; depth.mm = 0; - while (--n = 0 s-time.seconds = picture-offset.seconds) { + while (--n = 0 s-time.seconds = (uint32_t)picture-offset.seconds) { depth.mm = s-depth.mm; s++; } -- 1.7.11.msysgit.0 ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
Re: Any problem with the mail server ?
Umm… why is this on the Google group that is supposed to be for our users? On Oct 26, 2014, at 2:59 PM, Tomaz Canabrava tcanabr...@kde.org wrote: Em 26/10/2014 18:44, Salvador Cuñat salvador.cu...@gmail.com escreveu: It's pretty strange to be 4 days without a single post in the mailing list, the last I received was in Oct, 22. Last commit in git is also from Oct, 22. I know it sounds crazy, but I don’t actually work on Subsurface 24x7. It only feels that way. So yes, the last few days I have been really busy at my actual job and then Linus and I traveled to San Jose where we had the pleasure to be the surprise speakers at the GSOC mentor reunion - and got to hang out with Miika and Anton. Which mean that the two of them had been traveling this week. All of which conspired to reduce the mail traffic over here... Im on hold again, again. My dad is having some serious issues and im again without time. Ugh. Ugh indeed. This has been a tough tough time for you. I’m so sorry. /D ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface
[PATCH 6/9] deco.c: remove unused variables in add_segment()
From: Lubomir I. Ivanov neolit...@gmail.com Signed-off-by: Lubomir I. Ivanov neolit...@gmail.com --- deco.c | 1 - 1 file changed, 1 deletion(-) diff --git a/deco.c b/deco.c index 8dcfb7e..d0bcaa6 100644 --- a/deco.c +++ b/deco.c @@ -187,7 +187,6 @@ double he_factor(int period_in_seconds, int ci) double add_segment(double pressure, const struct gasmix *gasmix, int period_in_seconds, int ccpo2, const struct dive *dive) { int ci; - int fo2 = get_o2(gasmix), fhe = get_he(gasmix); struct gas_pressures pressures; fill_pressures(pressures, pressure, gasmix, (double) ccpo2 / 1000.0); -- 1.7.11.msysgit.0 ___ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface