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