4

We have a Debian-based embedded device. It runs an application that communicates with other embedded equipment via serial (RS-232, /dev/ttyS*). Usually, this works just fine. But of course, sometimes things go wrong and while our app can still send bytes without errors, nothing comes back from the other side.

Now I would like to be able to distinguish between

  • [A] The serial connection is live/up/established (I know I am probably using inappropriate terminology) in the sense that the other device is receiving our data. But for whatever reason the application on the other device doesn't talk back to us (e.g. because it had crashed).

  • [B] The serial connection is not live/up/established, e.g. because the cable was unplugged or the other device lost power.

Is there a way to do that? (like with an Ethernet connection, where it's really simple to tell whether or not it has link)


Some details:

  • NS16550A chip with serial8250 driver
  • Debian 7 32bit
  • Application is Python 2.7
Nils Toedtmann
  • 3,202
  • 5
  • 25
  • 36

2 Answers2

3

No, there is no way to do this. Serial connections are completely stateless, both from an electrical and a software point of view.

Sven
  • 97,248
  • 13
  • 177
  • 225
2

Just to give a completely contradictory answer... if your software supports it and your connection has more than the bare minimum # of pins, RS-232 connections can have handshaking and flow control. Your app could check for a connection before sending, but it sounds like it doesn't.

Ward - Reinstate Monica
  • 12,788
  • 28
  • 44
  • 59
  • Many devices that don't use hardware flow control still assert DTR so this seems worth a try. – PeterJ Feb 23 '16 at 04:00
  • Thank you! I'll read into it and will give it a shot. Oh, while we are talking ... Is it possible that the other side has (unbeknownst to me) RTS/CTS and/or DTR/DSR enabled, while my side has not? Or would comms fail in that scenario? – Nils Toedtmann Feb 23 '16 at 12:16