6

Is there a utility software (or an easy method to do it from shell script) to display a serial port's status — i. e. blinking “RXD”, “TXD”, “DCD”, “DTR”, “DSR”, “RTS”, “CTS”? Particularly, I need to monitor whether “DCD” line is set most of the time and momentarily cleared on some interval. The port doesn't need to be sniffed, it's okay to open it exclusively.

In DOS and Windows world, it's usual for terminal emulator and other modem-related software to display pin status, either in GUI or in console applications. However, I couldn't find an alternative even for Linux (although some say it may be possible to examine /proc/tty/driver/serial by hand, if it exists), not to mention FreeBSD, which is my actual target. Common tools like cu and minicom only display port settings at most, not the status.

2
  • Not an answer, but e.g.,cat /proc/tty/driver/ttyAMA (exists, but unused) outputs serinfo:1.0 driver revision: 0: uart:PL011 rev3 mmio:0x20201000 irq:83 tx:65 rx:0 RTS|CTS|DTR.
    – goldilocks
    Dec 7, 2014 at 14:33
  • 1
    @goldilocks FreeBSD, unlike Linux, only uses /proc to represent actual process information, and it's not even mounted by default. Likewise, FreeBSD doesn't provide /sys (this path is used for system sources instead). It's because sysctl should be used to access corresponding data, but I couldn't find any direct counterpart in it to that would exist in Linux in regard to my question. Dec 7, 2014 at 15:29

2 Answers 2

1

AFAIK you can read the DCD pin using ports. According to https://www.freebsd.org/doc/en/articles/serial-uart/, DCD lives in bit 7 of the Modem Status Register (port 0x06+PORT_ADDR). For your application, Bit 3, DDCD probably is better though. It's also possible to hook interrupts, take a look at the Modem Status Change interrupt.

2
  • The question was about already existing software or shell snippet, well-written and tested. There is no doubt that the status may be programmatically read by a custom, manually written software. Currently, I am using Python with py-serial for this task, but still hope there is a better alternative (not to the Python, but to my very own self-invented wheel). Jan 4, 2015 at 15:50
  • 1
    @AntonSamsonov AFAIK there is no well-tested utility available, and a cursory find on the ports tree was inconclusive. In your question you also specified that you would also be looking for "an easy method to do it from shell script". While "easy" may be debatable, this is a viable method from a shell script. IO ports can be read via shell builtins from /dev/io. This could be implemented in several lines of pure shell.
    – plonk
    Jan 5, 2015 at 18:03
0

Ckermit was a very capable serial/modem communications program for Unix-based computers, but I don't remember if it supported a feature of visually displaying the status of RS232 control pins. The project slowed down since Columbia U. suspended support for it in 2011, but it seems to be coming back.

I can't tell from www.kermitproject.org whether it has this kind of feature or not. A number of Linux distros have ckermit packages, perhaps it's worth trying out.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .