no dives are shown in the Dive List

Jef Driesen jefdriesen at telenet.be
Mon Jan 27 01:53:38 UTC 2014


> On Fri, 2014-01-24 at 23:06 -0800, Jun Song wrote:
>> Hi, I manage to connect my dive comp to subsurface but after every
>> download, my dives will still be empty.
>> Can you help?
>> My dive comp is OSTC Mk2 from Heinrichs Weikamp..
> 
> If you create a libdivecomputer dump, then no dives will be added to 
> the
> dive list.
> 
> We have had one other user that couldn't successfully download from his
> divecomputer until he manually created one dive in his divelog.
> 
> I can't reproduce this behavior here (Subsurface happily downloads from
> my OSTC 2N even when I start from an empty file) but that may be
> something worth trying. But please make sure that you do not have the
> libdivecomputer dump option set.

I think the real problem is something else. Jun Song's dives fail to 
parse. Not sure why yet. But that's just one part of the problem. When I 
try download the memory dump into subsurface, I can confirm no dives are 
imported. No error message is shown. So it seems subsurface is silently 
dropping dives that are failing to parse. That's the second part of the 
problem.

I quickly checked the subsurface code. The dive_cb function exits 
immediately in case of a parsing error, and as a result the dive never 
gets added anywhere. But the error is also never reported back to the 
user. There is a call to the dev_info function to show an error message 
in the progress bar, but I assume that because the download dialog is 
closed almost immediately, the user doesn't have a chance to notice this 
error message.

The libdivecomputer error code is used as the exit code for the dive_cb 
function. But this is not used to communicate errors back to the caller. 
The return value of the callback function is used to tell 
libdivecomputer whether it should proceed with the next dive or not. It 
should be either 0 (abort) or 1 (continue). Note that the (negative) 
dc_status_t error codes happens to work too, because all non-zero values 
evaluate to "true" in the boolean expression that is used internally.

Jef


More information about the subsurface mailing list