home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / sys / sun / admin / 9804 < prev    next >
Encoding:
Internet Message Format  |  1992-12-30  |  5.5 KB

  1. Path: sparky!uunet!meaddata!dem
  2. From: dem@meaddata.com (David Myers)
  3. Newsgroups: comp.sys.sun.admin
  4. Subject: An FAQ: Using Dial-in and Dial-out on the Same Serial Port
  5. Date: 30 Dec 1992 05:57:11 GMT
  6. Organization: Mead Data Central, Dayton OH
  7. Lines: 116
  8. Message-ID: <1hrdnnINNf0p@meaddata.meaddata.com>
  9. NNTP-Posting-Host: lake.meaddata.com
  10.  
  11.    This subject comes up quite frequently on the Net, and the current
  12. FAQ just says RTFM, so I thought I'd write up an actual answer so that
  13. I have something to mail people when I see this question asked over
  14. and over.  And maybe this will find its way into the FAQ.  Please mail
  15. me any corrections.
  16.  
  17.    *** How to use both dial-in and dial-out on the same serial port on
  18. a Sun running SunOS 4.1.X. ***
  19.  
  20.    SunOS supports using serial ports bidirectionally, and you don't
  21. need any extra programs like uugetty to do it.  The support is
  22. provided by the standard serial port driver for the zs ports, and many
  23. add-on serial ports (like ALM-2 and CoALM) come with drivers that
  24. provide identical support.  The trick here is to create a second
  25. special device file under /dev that will be used by programs which
  26. dial out, while the original device file is used by getty(1) to handle
  27. programs which dial in.
  28.  
  29.    To get this to work, you must ensure that the carrier detect signal
  30. (DCD) is being handled normally.  By default, SunOS ships with
  31. so-called "software carrier detection" turned on.  This means that DCD
  32. is held high in software for the benefit of stupid devices that might
  33. be connected to the serial ports.  For modems, this won't do.  You
  34. turn off "software carrier detection" by altering the keyword "local"
  35. in the entry in /etc/ttytab for the port in question.  Then, either
  36. reboot, or use the ttysoftcar(8) command to alter the DCD handling on
  37. the fly.  See the man page for ttysoftcar.
  38.  
  39.    Once DCD handling is correct, then the getty process you run on the
  40. device (by changing the keyword "off" to "on" in /etc/ttytab) will
  41. block trying to open() the it until DCD goes high, which will be the
  42. case when someone connects to your modem (check your modem settings --
  43. you might need to set AT&C1&W for DCD to be handled correctly).  The
  44. new special device you're about to create, however, will be able to
  45. open() the port with DCD down (as is the case when UUCP wishes to
  46. establish a connection) *unless* the port is already open()ed in the
  47. incoming direction.  Correspondingly, getty won't be able to open()
  48. the port if it's already in use by an outgoing process.
  49.  
  50.    It's traditional to rename ttya and ttyb to ttyd0 and ttyd1 when using
  51. them for incoming connections.  For one thing, it makes it somewhat
  52. more obvious that someone's dialed in from outside when you see
  53. they're on a ttyd? port.  For another thing, you can have the login(1)
  54. program send immediate notification of someone logging in to a ttyd?
  55. port to (for example) your console by adding a line like the following
  56. to /etc/syslog.conf (and sending a SIGHUP to syslogd):
  57.  
  58. auth.notice                                  /dev/console
  59.  
  60.    See the manual page syslog.conf(5) for more information.  The point
  61. is that login knows that a ttyd? port is special, so it's often useful
  62. to do the renaming.
  63.  
  64.    For the new, outgoing devices, it's traditional to call them cua0
  65. and cua1 (which would correspond to ttyd0 and ttyd1, respectively).  I
  66. don't think there's anything special about these names.
  67.  
  68.    You create the new devices in /dev so as to have the same major
  69. device numbers as the already existing devices, but with a minor
  70. device number 128 greater.  Proceed as follows:
  71.  
  72. # cd /dev
  73. # ls -l tty[ab]
  74. crw-rw-rw-  1 root      12,   0 Dec 11  1990 ttya
  75. crw-rw-rw-  1 root      12,   1 Dec 11  1990 ttyb
  76. # mv ttya ttyd0
  77. # mv ttyb ttyd1
  78. # ls -l ttyd?
  79. crw-rw-rw-  1 root      12,   0 Dec 11  1990 ttyd0
  80. crw-rw-rw-  1 root      12,   1 Dec 11  1990 ttyd1
  81. # mknod cua0 c 12 128
  82. # mknod cua1 c 12 129
  83. # ls -l cua?
  84. crw-r--r--  1 root      12, 128 Dec 30 00:13 cua0
  85. crw-r--r--  1 root      12, 129 Dec 30 00:13 cua1
  86. # chown uucp cua?
  87.  
  88.  
  89.    Remember to edit /etc/ttytab and rename ttya and ttyb to ttyd0 and
  90. ttyd1 there, too.
  91.  
  92.    Finally, make sure programs which initiate outgoing connections use
  93. the cua? devices.  You would change this in /etc/remote for tip(1), and
  94. /etc/uucp/Devices for UUCP.
  95.  
  96.    As long as you're setting up your serial ports, it's a good idea to
  97. make sure that both your SunOS programs and your modem are using
  98. hardware flow control (also called RTS/CTS flow control).  Some form
  99. of flow control is usually necessary, but using software flow control
  100. (also called XON/XOFF flow control) in your modem will mess up UUCP.
  101.  
  102.    First, turn on hardware flow control in your modem.  Consult the
  103. manual that came with your modem on how to do this.  For a recent
  104. Telebit modem (QBlazer, T2500, T3000, or WorldBlazer), you'd connect
  105. to the modem and send it the string ATS58=2&W.
  106.  
  107.    Next, make sure the software using the port knows to use hardware
  108. flow control.  For UUCP, add the following pseudo send string to the
  109. end of the entry or entries you're using in /etc/uucp/Dialers:
  110.  
  111.     STTY=crtscts
  112.  
  113.    For getty, add the following capability to the entry or entries
  114. you're using in /etc/gettytab:
  115.  
  116.     :ms=crtscts:
  117.  
  118.    Note to ALM-2 users:  Due to severe brain damage, you can only use
  119. hardware flow control on the first four serial ports of the ALM-2.
  120. Yes, you wasted your money.
  121.  
  122. --
  123. David Myers                                             (513) 865-1343   
  124. Mead Data Central           No news is             Fabrication Systems
  125. P.O. Box 933                 bad news.                dem@meaddata.com
  126. Dayton, Ohio  45401                             ...!uunet!meaddata!dem
  127.