First time subsurace usage surprises

Lutz Vieweg lvml at 5t9.de
Tue Jul 31 14:48:20 PDT 2012


On 07/31/2012 10:58 PM, Linus Torvalds wrote:
> On Mon, Jul 30, 2012 at 4:28 PM, Lutz Vieweg<lvml at 5t9.de>  wrote:
>>
>> subsurface does not seem to have a "default" file where it stores dive data.
>> I wonder how many people actually favour to manually open and save their
>> dive data file upon every start / ending of the program.
>> (I will certainly apply a local patch for me to use a default data file name
>> that is automatically opened / saved on start / exit.)
>
> I don't know what the default file would be, but I don't hate the
> idea.

This works good enough for me:

diff --git a/gtk-gui.c b/gtk-gui.c
index 45aa212..b62d9d5 100644
--- a/gtk-gui.c
+++ b/gtk-gui.c
@@ -813,6 +813,23 @@ void init_ui(int *argcp, char ***argvp)

  void run_ui(void)
  {
+
+       {
+               /* try to load default data file */
+               GError *error = NULL;
+               char filename[NAME_MAX+1];
+
+               snprintf(filename, NAME_MAX, "%s/.subsurface/divedata.xml", getenv("HOME"));
+
+               parse_file(filename, &error);
+               if (error != NULL)
+               {
+                       report_error(error);
+                       g_error_free(error);
+                       error = NULL;
+               }
+       }
+
         gtk_main();
  }


But maybe we should offer the luxury of an automatic mkdir() for ~/.subsurface, too?

(I don't like that ~/.gconf/apps/subsurface/ stuff too much, why should
an application write some defaults deep into a directory structure that
is named after some GUI toolkit...?)


>> When saving data, subsurface did not suggest a certain file extension, so I
>> used none.
>
> Yeah, that's just because I don't know the gtk file stuff well enough.

Hehe, I don't know either (my GUI toolkit experience is limited to
Tk, and, well, C64 & Amiga custom chip programming in assembler ;-))

But my patch above suggests the name ".subsurface/divedata.xml" visibly
to the user upon first start, that's better than nothing ;-)


>> I miss a feature to change attributes of several dive logs at the same time.
>
> I do too. I'd love for the multi-selection to work for all the
> equipment issues etc. It doesn't, and it's non-trivial to fix.

Ugh. That doesn't speak for Gtk's ease of use, would have been somthing
like a one-liner in Tk :-)

> The creation of the model for the
> cylinder is incestuous with the actual display routines.

This side effect might not be bad, after all, cloning data from some previous
dive could save effort for users in many ways.


>> While reading data from my D9 I got some "failed to receive the answer"
>> messages.
>
> Jef already answered this one. The occasional one is not a problem,
> just ignore them.

I can say now that I see them too rarely to be of use for debugging.

> I'd love to show them in the GUI (and *hide* them if
> we get good data afterwards), but most of those things are actually
> stderr output from libdivecomputer.

That way, non-shell users won't see them, anyway, and shell users may
welcome them as informative and know how to 2>/dev/null if really necessary. :-)

> The Suunto electricals
> are just not very nice. They chose to do a two-wire communication
> model

Two wires? The D9 plug has two male pins plus ground/shielding - that would
be sufficient for one RX and one TX line, and thus "full duplex", theoretically...

> No clock lines, no nothing. So it's just rather timing-sensitive.

Well, at only 9600 baud no electronics of today should be that sensitive :-)

> I like our printouts, and we spent some effort on it, but yeah, I
> could imagine a denser text-only format without the profile.
>
> Patches welcome.

I'll see what I can do before it's time for me to use subsurface in the field
(Curacao in September).

Regards,

Lutz Vieweg





More information about the subsurface mailing list