Dive data import error with Hollis DG03

Jef Driesen jef at libdivecomputer.org
Wed Mar 26 05:19:11 PDT 2014


On 2014-03-26 11:35, Hamish Moffatt wrote:
> On 26/03/14 21:31, Hamish Moffatt wrote:
>> On 26/03/14 19:17, Jef Driesen wrote:
>>> I've noticed in the past that many dive computers require some delay 
>>> between open the serial port and sending the first request. That's 
>>> why in most libdivecomputer backends, you'll find a 100ms delay, 
>>> followed by a flush of the input buffer (that's another oddity, 
>>> because I have no idea how there can already be any data in the 
>>> buffer immediately after opening the serial port). Anyway, without 
>>> that 100ms delay the communication just fails. Maybe the dive 
>>> computer needs some time to notice the usb connection? I really don't 
>>> know.
>> 
>> I think the data already in the buffer is caused by the act of 
>> plugging the cable into the dive computer, while it's already plugged 
>> into the USB. You'll get a whole lot of garbage into the buffer as the 
>> pins make contact, and probably bounce a fair bit. I don't think the 
>> VT3 connection is particularly sound mechanically either.
>> 
>> On the other hand if you plug it into the dc and then the USB port you 
>> shouldn't get any data.
>> 
> Just tested that and confirmed, I get input=0 on the flush if I
> connect the dc end first, input=17 or less on the flush if I connect
> the USB first. (Tested on the Mac, not that it's important.)

Line noise makes sense. Although, I would think that any garbage data 
that may be sitting in the receive buffer would get flushed when an 
application opens the serial port. That might be tricky on linux because 
by default serial ports are  not opened with exclusive access. So two 
applications can open the same port. If the second application would 
flush the data when opening the port, that could throw away data that 
the first application needs. If the OS does not allow concurrent access, 
like on Windows, than that's not an issue or course.

I can't think of any use case for concurrent access to serial ports. 
Maybe for pty's that might be different?

Jef


More information about the subsurface mailing list