FreeBSD 9.1 Carrier Detection

Rad Stor rstor22 at gmail.com
Wed Jun 12 16:08:59 UTC 2013


Background:

I was having troubles with carrier detection for modems/null modem
connections under Solaris 8 (i.e. login session remains active after the
modem disconnects). I tried two different dumb modems (do not respond to AT
commands). They both output the appropriate voltage on the CD  line when a
carrier is detected/not detected (I have confirmed this using a volt meter
and applying the appropriate carrier tone via a function  generator). I
then decided to try a null modem connection  When accessing the serial
console on the Solaris 8 system using a null  modem cable, the login
session remains active when disconnecting the cable and plugging it back
in. To my understanding this should not happen, in the first case with the
modem, or with the null modem cable (as I disabled software carrier
detection).

I decided to test out carrier detection on FreeBSD 9.1 on a different
machine running within virtual box. I used a usb-serial dongle which shows
up as ttyu0 on the BSD machine. Carrier detection appears to work. When I
establish a null modem connection I receive a login prompt. If I login, and
then unplug and plug back the cable, I get the login prompt again and the
old session does not continue. This is the correct behaviour to my
understanding however I am curious of the way the getty process behaves,
esp. on bootup in FreeBSD.

Question:

The line in my /etc/ttys file is as follows:

ttyu0   "/usr/libexec/getty std.300"   dialup on

I then issued the command "kill -HUP 1" and restarted the system with
*nothing* plugged into the serial port.

Reading the documentation it is my understanding that when the system
starts up and no carrier is detected, when issuing the ps -ax command, the
result I am supposed to see should be something as follows:

  114 ??  I      0:00.10 /usr/libexec/getty std.300 ttyu0

However I instead see a similar output to the above but the question marks
are replaced by letters. Per the documentation at :
ttp://www.freebsd.org/doc/en/books/handbook/dialup.html it indicates that
if something like this is displayed it means that "getty has completed its
open on the communications port. This could indicate a problem with the
cabling or a misconfigured modem, because getty should not be able to open
the communications port until carrier detect has been asserted by the
modem."

I figured that since nothing is connected into the serial port, perhaps the
voltage levels may be floating, instead of being held at the negative
voltage which would indicate no carrier. I therefore applied a negative
voltage to the CD line and restarted the system. Upon restart I issuing the
ps -ax command and the result was as before, letters instead of the
question marks. I then manually applied a positive voltage to the CD line
and then a negative voltage again. I had to do it a couple times
however eventually it showed up with question marks. I then was able to
toggle back and forth, positive voltage resulted in letters, negative voltage
on CD line resulted in question marks (which is the correct behaviour to my
understanding).

Why is it that when a negative voltage is applied to the CD line, upon
system start-up  getty indicates via the ps -ax command that it has opened
the port? [i.e. letters appear instead of question marks] I would expect
that with a negative voltage applied to the CD line,
upon restart it would show up with ??

I need to toggle the voltage between negative to positive and then back to
negative (sometimes I need to do it a couple times) for it to eventually
show up with ?? and then it would toggle back and forth as I switch the
voltages thereafter.


More information about the freebsd-questions mailing list