Dive data import error with Hollis DG03

Jef Driesen jef at libdivecomputer.org
Wed Mar 26 05:48:21 PDT 2014


On 2014-03-26 13:29, Hamish Moffatt wrote:
> On 26/03/14 23:19, Jef Driesen wrote:
>> 
>> I can't think of any use case for concurrent access to serial ports. 
>> Maybe for pty's that might be different?
> 
> Not if they're both pulling from the same buffer, no.... if both got
> their own copy of all the received data that might be useful for
> sniffing applications.

With pty's there is definitely only one buffer. If discovered this the 
hard way, when I accidentally had two applications talking to the same 
simulator instance. This gives very weird results... That's when I 
started looked into enabling exclusive access for libdivecomputer.

Exclusive access is still disabled for pty's, but for a different 
reason. Apparantly, the exclusive mode flag is shared between the master 
and slave side of the pty. Thus when your application sets the flag and 
then closes the port (without clearing the flag again), the flags 
remains sets and any future attempt to open the pty will fail. The only 
way to fix this is to restart socat, and that's more annoying than 
accidentally have two applications talking to the same pty.

But for real serial ports, exclusive access seems to do its job well. 
Well, I didn't get any complaints after I enabled it :-)

Jef


More information about the subsurface mailing list