Menu

#17 DTR Handling Seems Screwy on Linux

YAAC 1.0-beta
open
nobody
None
2020-07-15
2020-07-06
Rob Riggs
No

I am using YAAC with a Mobilinkd TNC3 (I am wx9o, rob at mobilinkd.com). The TNC3 detects open/close when connecting via USB by sensing changes to DTR. It is connected when DTR is asserted and disconnected when DTR is de-asserted. This is the way many USB CDC serial devices work.

YAAC appears to invert DTR rather than setting an explicit state. YAAC also seems to get confused about the DTR state. The end result is that YAAC can get into a state where it thinks it is connected and the TNC3 thinks it is disconnected. And then when exiting YAAC in that state, it sets DTR to indicate it is connected and then exits. This leaves the TNC3 thinking there is an open serial connection when none exists.

The TNC3 uses the DTR line to sense connect/disconnect. It can accept connections via Bluetooth or USB, but only one connection at a time. When no connections are present, Bluetooth and USB are both "available". When a connection is made, the other port is disabled. This is done either by stalling the USB connection or holding the Bluetooth module in reset.

It is perfectly valid to connect the TNC3 to USB for charging, connect to it via Bluetooth to configure it, then connect to it using an app like YAAC via USB, then connect via Bluetooth again. The TNC3 disables the port that is not in use to prevent connections.

When the TNC3 USB interface is disconnect with DTR asserted, Bluetooth is disabled and it can only be connected via USB.

When DTR is enabled for a port, DTR should be explicitly asserted when a connection is made and explicitly de-asserted when the connection is closed.

You are welcome to reach out at my email address mentioned above if you have questions about this or if I can help in any way.

Discussion

  • Andrew Pavlin

    Andrew Pavlin - 2020-07-07

    Which port type are you using in YAAC? Serial_TNC or Bluetooth_TNC? Or something else? In the Serial_TNC driver, you can specify the desired behavior of the DTR signal by specifiying whether DTR should be activated on port opening (the default) or deactivated by checking the "No DTR" checkbox; however, this doesn't work if hardware flow-control is enabled (then DTR is always supposed to be activated). I can't say what the operating system default setting of DTR is when a serial port is closed, but YAAC has no control over that.

     
  • Rob Riggs

    Rob Riggs - 2020-07-10

    The problem occurs when using the USB serial port. I am running Linux (Fedora 31). And it seems like a YAAC problem because it is the only software where I have experienced this behavior. Sometimes the behavior is normal, sometimes not.

    I found that I can connect/disconnect using a terminal program that behaves properly (such as minicom or cutecom) to have it reset the DTR on disconnect and return the TNC to a sane state.

     
  • Andrew Pavlin

    Andrew Pavlin - 2020-07-15

    I have a prototype fix converting to using the JSSC library instead of the RXTX library, which will solve the file locking issue, but I'm not sure if it will solve the DTR twitching issue, because both libraries verify the list of usable serial ports by opening them briefly and then immediately closing them, which will cause the kernel driver to change modem control signals.

     

Anonymous
Anonymous

Add attachments
Cancel