Unix/Linux Go Back    


BSD BSD, sometimes called Berkeley Unix, is a Unix operating system developed by the Computer Systems Research Group of the UC Berkeley.

Carrier Detection in FreeBSD

BSD


Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 06-13-2013   -   Original Discussion by rstor
rstor rstor is offline
Registered User
 
Join Date: Jun 2013
Last Activity: 16 June 2013, 2:33 PM EDT
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
Carrier Detection in FreeBSD

Regarding carrier detection on FreeBSD 9.1 being run 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:


Code:
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 online, 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:


Code:
  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 online 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.

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.

Last edited by Scott; 06-13-2013 at 07:06 PM.. Reason: Please use code tags for code, data and terminal output
Sponsored Links
    #2  
Old Unix and Linux 06-14-2013   -   Original Discussion by rstor
DGPickett DGPickett is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 1 February 2016, 3:35 PM EST
Location: Southern NJ, USA (Nord)
Posts: 4,673
Thanks: 8
Thanked 587 Times in 560 Posts
So what is the question? FreeBSD knows what i needs to know about peripherals and no more. When it finds a serial port, it creates a support program for it. Different rs232 ports can have different sets of leads implemented. CD may be one that the driver trusts more than say DTR or CTS.
Sponsored Links
    #3  
Old Unix and Linux 06-16-2013   -   Original Discussion by rstor
rstor rstor is offline
Registered User
 
Join Date: Jun 2013
Last Activity: 16 June 2013, 2:33 PM EDT
Posts: 7
Thanks: 2
Thanked 0 Times in 0 Posts
My question was that according to my understanding of the documentation found here:

(27.4.6.1. Checking Out the FreeBSD System)
27.4.*Dial-in Service

When FreeBSD sees no carrier, getty should not have completed its open on the communications port. According to the setup described in my opening post, getty was opening the communications port regardless of carrier when the system is brought up. However; once there is a carrier signal applied, then it behaves correctly to my understanding.

I have found out where my problem was. Here is what I did:

I took two DB9 Male-Female connectors and removed all pins except receive, transmit, and ground. I connected the two connectors to each end of my null modem cable. The end result is a null modem cable that will only use these three lines.

I installed FreeBSD on an actual machine with a serial port (instead of using FreeBSD on VM Virtual Box with a usb-serial dongle). I connected my modified null modem cable to the FreeBSD machine and the other end to a PC.

Executing ps -ax on the above FreeBSD machine resulted in the following:


Code:
749 ?? S 0:00.01 /usr/libexxec/getty std.300 ttyu0

This is the correct behaviour to my understanding.

Using the modified cable on the virtual FreeBSD machine connected to a PC and executing ps -ax resulted in the following:


Code:
683 u0 Ss+ 0:00.06 /usr/libexec/getty std.300 ttyu0

Conclusion:

On the virtual FreeBSD machine which had a usb serial dongle, getty opens the communication port on system startup which it should not do to my understanding. On a real system it performs as indicated in the documentation.
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Carrier Detection in Solaris 8 for Dial in and Null Modem Connections rstor Solaris 6 06-16-2013 03:17 PM
Power Line Carrier (PLC) mohsenmahoor UNIX for Dummies Questions & Answers 2 12-27-2012 01:36 PM
Parallel Processing Detection and Program Return Value Detection azar.zorn Programming 4 07-01-2011 07:13 PM
no carrier merlin UNIX for Dummies Questions & Answers 2 07-08-2002 02:32 AM



All times are GMT -4. The time now is 08:22 AM.