I've been having some fun connecting my server to an embedded device that outputs some data and should also have a prompt to enter commands. This is kind of a long question/post, but there's a lot of fiddly data.
I am running Ubuntu 12.04.3 LTS 64-bit and I'm using a cheapy USB Bluetooth card to connect to a LC-06 (model HC-06, just an LC-06 attached to a board, slave mode) bluetooth serial port. After setting the baud rate for the embedded device, I was able to see data just fine from the device.
So, to connect to the device, I have to do a few things. I set up my /etc/bluetooth/rfcomm.conf file to see the device but not bind to it automatically.
bluetooth-agent <mypin> &
rfcomm bind rfcomm0
Then I try to connect using screen (screen /dev/rfcomm0) or minicom. Minicom connects more reliably, but screen allows me to connect and detach the terminal. Plus if I am successful connecting using minicom then exit I get a better chance of connecting with screen.
About 80% of the time it connects if it's physically close enough to my USB bluetooth card, if it's further away, it's more like 20-30%. Once it's connected though, it seems to be pretty solid.
Now, to get to my issues. First, the data from the embedded device only issues line-feeds not carriage-return line-feeds. Presumably, stty allows you to rewrite incoming lf to crlf using the inlcr option. If I issue an
stty -F /dev/rfcomm0 inlcr
the output should immediately start lining up instead of stair-stepping, but it doesn't. I'm not sure if this is an issue with stty not affecting rfcomm or something else.
My second issue is that I don't seem to be able to write to the device. I don't know if that's because I need to set up my rfcomm connection differently for writing or use something else than screen for the connection (I couldn't write with mincom either). I've tried turning on local echo by running
stty -F /dev/rfcomm0 echo
but that doesn't seem to have any affect either.
I hope someone can either help me directly or point me to better resources than I've been able to find on these issues. Information on interaction between stty and rfcomm seem pretty non-existant, and that usually means I'm not looking the right way. Also setting up rfcomm.conf information seems pretty scarce (what kind of options are there for this file?).