On 16-01-14 11:42, Patrick Valsecchi wrote:
I've investigated this issue on Linux some time ago and contacted the bluez
mailing list about that. They totally ignored me but a week later, another guy
had the same problem and did a better investigation than me. His conclusion was
that if we open /dev/rfcomm0 in asynchronous mode and then write to it, we are
screwing bluez and the first write fails because it happens before the rfcomm
link is completely setup.

I've tried to modify the libdivecomputer to open in synchronous mode and then
set the fd to asynchrounous afterwards, but the dive transfer was still failing
on the first read operation. I've sniffed the USB communication and looks like
something is sending seemingly random characters  before and after the command
we send.

Since I had the impression that I was the only one with this problem in the
subsurface community and the bluez community was ignoring me, I've quit after 8h
of investigations.

You are certainly not the only one having trouble with bluetooth/rfcomm on linux. Most of the time, I'm also unable to download from the Shearwater Petrel and the Heinrichs-Weikamp Frog most of the time. It used to work very well in the past, but not any more.

I think your explanation makes sense, considering what I observe with the Petrel. Opening the /dev/rfcommX works fine, but immediately after sending the first command, the Petrel displays an error and disconnects. (I don't remember the exact error message.) If you saw some garbage data, then that might be the root of the problem. I suspect the Petrel fails to identify this garbage data as a valid packet and aborts the communication.

Because of this, I started experimenting with using bluetooth sockets instead of the rfcomm serial emulation. And guess what, it works very reliable! I couldn't get it to fail once.

So in the long run, I definitely want to switch to bluetooth sockets. I already have a working prototype for linux and windows (in a nutshell communication is working, but device discovery isn't implemented yet), but Mac OS X is another story. I don't have any experience with the Mac OS X api's or even Objective C, so I didn't get very far.

Jef
_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to