home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / aix / 9558 < prev    next >
Encoding:
Text File  |  1992-09-10  |  17.9 KB  |  312 lines

  1. Newsgroups: comp.unix.aix
  2. Path: sparky!uunet!psinews!usenet
  3. From: robin@pencom.com (Robin D. Wilson)
  4. Subject: Re: High-speed modem at ... (Very LONG)
  5. Message-ID: <1992Sep10.170908.22631@psisa.psi>
  6. Sender: usenet@psisa.psi (News system)
  7. Reply-To: robin@pencom.com
  8. Organization: Pencom Systems Incorporated
  9. References: <98@jassys.UUCP>
  10. Date: Thu, 10 Sep 1992 17:09:08 GMT
  11. Lines: 299
  12.  
  13. Well, since there has been soooooo much interest in it (and because I got  
  14. tired of sending off individual responses, here is my modem setup guide for  
  15. the RS/6000 and AIX systems.
  16.  
  17. Disclaimer: This is provided without warrantee, it was written while I worked  
  18. at IBM Defect Support, and that was 1.5 yrs ago.  It still seems to apply to  
  19. 3.2 code (for the most part), but don't hold me to that.
  20.  
  21. BTW, If I calim something as fact, it is really only MY interpretation of the  
  22. the facts.  So take it all with a grain of salt... Hope this helps.
  23.  
  24. Here it is:
  25.  
  26. ------------------------------CUT HERE---------------------------------------
  27. To set up modems in general requires an understanding of several important
  28. concepts:
  29.  
  30.     1) (D)CD (Data) Carrier Detect.  This is a voltage signal placed
  31.     on pin 8 of the RS232 DB25 serial connector.  It is used to tell
  32.     the DTE (Data Terminal Equipment - in this case the computer to
  33.     which the modem is attached) that the DCE (Data Circuit terminating
  34.     Equipment - the modem) has established a logical 'wire' from point-
  35.     to-point.  In other words, we are connected from the serial port on
  36.     your computer to the serial port on the other device to which you are
  37.     attempting to communicate.
  38.  
  39.     2) DTR (Data Terminal Ready).  The DTE device is ready to talk.  
  40.     This is a voltage on pin 20 of the RS232 DB25 serial connector.  It
  41.     is intended to alert the DCE device to the 'existance' of the DTE
  42.     device.  (Sometimes this is used for a rudementary form of hardware
  43.     flow control also... Turn off DTR == stop talking, Turn on DTR ==
  44.     start talking again.)  Basically with a modem this is used to 
  45.     signal to the modem that the DTE (in our case the computer) is 
  46.     ready to talk.  Usually this means that the tty has been opened
  47.     (by either a "getty" process or some other program - like "cu") and
  48.     the modem should enable "Auto-Answer" and prepare to accept commands.
  49.     When DTR drops, the modem should interpret this as "the DTE device
  50.     has been shutdown... time for me to hang up".
  51.  
  52.     3) Flow control.  This can either be accomplished through hardware
  53.     or software.  Hardware flow control can take many forms, but for 
  54.     modems there is really only one standard: RTS/CTS.  This form of
  55.     flow control uses a voltage on pins 4 and 5 (RTS and CTS pins) to 
  56.     signal to both sides of the connection when either side can accept
  57.     data.  If the voltage goes away, the other side should stop sending
  58.     data.  Software flow control usually takes the form of XON/XOFF 
  59.     flow control.  This is a character that is placed into the stream
  60.     of data going from one side to the other.  When the other side 
  61.     receives the XOFF character, it should stop sending, when it 
  62.     receives an XON character it can start back up again.  (There are
  63.     more serious limitations to the software flow control methods because
  64.     some programs generate binary data that could equal either an XON
  65.     or an XOFF character.  This means that the serial device will strip
  66.     those bits out of the data assuming that they were intended for 
  67.     flow control, when in reality they were part of the data.  The other
  68.     limitation is: if the remote side has sent an XOFF to the local side
  69.     (or visa versa) then the local side is not allowed to send any data
  70.     back to the remote side... including XOFF or other flow control 
  71.     characters.)
  72.  
  73. Enough with the basics.  Now you want to know how to set up your IBM RS/6000
  74. or your IBM RT to use a modem.  There are two sides to the setup: the tty 
  75. setup and the modem setup.  The tty is fairly easy.  For the most part your
  76. choice will be limited to the defaults from SMIT (for the RS/6000) or to
  77. the defaults from Devices (for the RT).  There is; however, one area to which
  78. you will need to pay particular attention: do I intend for this modem to be
  79. used for dial-in, dial-out, or bi-directionally?  One ofthe following 
  80. settings for "Enable LOGIN" (on the RS/6000) or "Automatic Enable" (on the  
  81. RT) will need to selected based on what you want to do:
  82.  
  83.     DISABLE: Use this setting if you only want to use the port for dial-out
  84.     type connections.  Basically, this setting does nothing but configure
  85.     the serial port.  No getty process is started, nobody can login on this
  86.     port (unless you decide to "penable, or pshare, or pdelay" the port at
  87.     some later point).
  88.  
  89.     ENABLE: This setting is best used for terminals (ie. not for modems), 
  90.     but it can work for "dial-in" only modem connections.  This setting
  91.     starts a "getty" process on the port.  This getty started in this
  92.     manner immediately locks the port, preventing any other process from
  93.     using the port.  Then, when getty sees the CD signal come up on the
  94.     port, it sends a login herald, allowing the remote user to login.
  95.     (IT IS SIGNIFICANT that the login herald is sent AFTER CD comes up.
  96.     Think about it like this... "the modem brings up carrier AFTER it has
  97.     negotiated the speed and connection parameters -- a "carrier frequency"
  98.     -- with the remote modem, so getty doesn't send the login herald until
  99.     the remote system/terminal is attached.")
  100.  
  101.     SHARE: This setting works well for "bi-directional" modem use.  This
  102.     setting causes a "getty -u" process to be started on the port.  The 
  103.     "getty -u" is the classic AT&T "uugetty" process.  Basically this 
  104.     type of getty starts on the port, and then waits for carrier to come
  105.     up before attempting to lock the port.  This allows other programs
  106.     to open the port, create a lock, and prevent the getty from locking
  107.     the port.  As an example, the port is "share'd", but I want to use it
  108.     to dial-out using the "cu" program.  I issue the cu command, and cu
  109.     opens the tty, and locks the port.  I connect to the remote modem, 
  110.     CD comes up.  (Remember that "getty" is still running, and just waiting
  111.     for CD to come up.)  Getty attempts to lock the port now (because CD 
  112.     came up), but "cu" has already locked the port so getty can't get a
  113.     lock.  The "getty" process then goes into a loop, "Do I have CD?
  114.     Yes.  Can I get the lock?  No.  Do I have CD? ..."  When the "cu"
  115.     process exits, CD is down, so the "Do I have CD?" part of the loop
  116.     fails, and getty just loops on that function.  When CD comes up due
  117.     to someone dialing-in, and no other process has the lock, getty says:
  118.     "Do I have CD?  Yes.  Can I get the lock?  Yes.  Great! issue a 
  119.     'login:' herald."  (Imbellishments added by the writer - you get the
  120.     general idea.)
  121.  
  122.     DELAY: This setting is nearly identical to the "SHARE" setting, except
  123.     the getty is called as: "getty -r" (which is the same as the AT&T
  124.     uugetty -r) and this version of getty is waiting to see a character 
  125.     on the serial input buffer (read() on the tty doesn't return '0'). 
  126.     before it attempts to lock the port.  So in the paragraph above, just
  127.     replace all occurances of "CD" and "Carrier" with "Character on the 
  128.     serial input buffer".
  129.  
  130. The modem setup can get a great deal more complicated.  Since there are so
  131. many different brands of modems, each with their own setup parameters and 
  132. commands, I will attempt to address them in a "generic" HAYES compatible
  133. manner, and let the reader find the equivalent settings for his particular
  134. brand modem.  Try to remember that most modems have settings for all of
  135. these parameters, but some modems call them different things, and some 
  136. divide them into "sub-categories" that are not discussed here.  I will try
  137. to explain why the settings are necessary, so that confusion can be limited.
  138.  
  139. You will need to make the following configurations for your modem:
  140.  
  141.     CD (Carrier, DCD, Data Carrier Detect, even CO) should be set to 
  142.         follow "true" carrier.  This means that it is not "strapped
  143.         high" on the modem, and that it only goes high when the 
  144.         remote modem is connected to the local modem.  The reason
  145.         this is important relates back to the 'getty' settings 
  146.         described above.  If getty is waiting for carrier to lock
  147.         the port and/or send out the login herald; strapping carrier
  148.         high will defeat the purpose of having distinct settings for
  149.         "ENABLE" and "SHARE" (ie. they will work functionally the
  150.         same).  Also, having getty echo a login herald to an 
  151.         unconnected modem can cause a loopback condition.  The modem
  152.         should usually be set to "echo" back the commands you type;
  153.         but when you send the "login:" herald, it echos that back too.
  154.         Getty will echo everything you type, so the login herald is 
  155.         echoed back to the modem, which echos it back, ad infinitum.
  156.         If there is no carrier until a connection is made, then; when
  157.         getty sends the "login:" herald, it is not echoed back, it is
  158.         sent on to the remote terminal.  Finally, if you strap carrier
  159.         high on the modem, the serial port device driver will not 
  160.         know when the connection has gone down.  For example, if the
  161.         remote modem is powered off during a connection, the local
  162.         modem will sense this, and hang up... BUT the local shell
  163.         process on the computer will see carrier up (because the modem
  164.         is set to "ALWAYS" present CD) and never log the user off.
  165.         The next person who calls in, will be able to use the previous
  166.         user's shell.  This is (needless to say) a severe security risk.
  167.         On the HAYES "V-Series" modems, the correct setting is:
  168.         AT&C1.
  169.  
  170.         NOTE:  If you use the "tip" program for dialing out, you NEED to
  171.         strap carrier high on the modem.  This is because "tip" is designed
  172.         to work with carrier on the port only.  (The port is opened, but
  173.         IO to the port is blocked until carrier detect is high.  This has
  174.         to do with the way the port is opened using the "open()" system 
  175.         call.)  To strap carrier "ALWAYS" high on a HAYES "V-Series" modem,
  176.         enter the command: AT&C0.
  177.  
  178.     DTR should be set to "hang up" and "disable auto-answer" when the DTE
  179.         device drops DTR.  Most modems will come with the factory
  180.         default set to ignore DTR signals from the DTE.  This way,
  181.         the modem will "auto-answer" right out of the box.  This is 
  182.         not what you really want.  On the RS/6000 the DTR signal is
  183.         raised when the tty device is opened with the 'open()' 
  184.         system call.  This means that "getty" will cause DTR to be
  185.         to be raised and the modem will be able to "auto-answer"
  186.         only when there is a getty running on the port.  The other
  187.         part of the equation is that the modem should hang up when 
  188.         DTR drops.  On most SysV type machines, the "stty" setting
  189.         of "hupcl" (Hang UP on last CLose) will cause DTR to drop on
  190.         the last "close()" of the open tty file descriptor (in other
  191.         words, when the last process using the port releases it, 
  192.         the device driver will stop asserting DTR).  This is the way
  193.         the computer signals to the modem to "hang up" the connection.
  194.         On HAYES "V-Series" modems, there are 2 possible settings:
  195.         AT&D2 (hang-up, disable auto-answer, and enter command state
  196.         when DTR is not present); and AT&D3 (hang up, disable auto-
  197.         answer, "RESET - reload operating parameters", and enter 
  198.         command mode when DTR is not present).  The big difference
  199.         is: "RESET".  This means that if you made changes to the 
  200.         software switch settings, and then dropped DTR without saving
  201.         the changes, they would be lost.  On the other hand, if someone
  202.         else made changes to the software switches, and you had the
  203.         AT&D2 setting, those changes would remain "in-force" until
  204.         you reset them.  Most people prefer AT&D3.
  205.  
  206.     Auto-Answer should be enabled if you intend to allow other people
  207.         to dial-in to your machine.  On the HAYES "V-Series" modems
  208.         this is software switch "S0=001".  (Which sets the number of
  209.         times to let the phone ring to "001".)  You can set this
  210.         with the command: ATS0=<num> (where <num> equals the number
  211.         of times you want the modem to let the phone ring before
  212.         it answers).  Try to remember if you intend to set this to 
  213.         something more than "1 ring", that most modems have a default
  214.         "timeout" value that is set around 30 seconds.  If the modem
  215.         calling you doesn't get a "carrier" tone within that timeout
  216.         it will hang-up, so setting a very large number of rings could
  217.         make your connection rate somewhat unreliable.
  218.  
  219.     Command Response should be set to respond to "LOCAL" commands only.
  220.         This one is a little tricky to describe.  Most modems try
  221.         to alert the local DTE device that there is activity coming
  222.         in from the outside world.  Normally, when an incoming call
  223.         is detected the modem sends the string "RING" to the local
  224.         DTE device.  This means that string will be echo'd back to 
  225.         the modem (because getty will turn on the "echo" on the tty
  226.         device).  When the modem sees any characters coming into it
  227.         on the receive serial line (the one coming from the local
  228.         machine), it immediately "HANGS UP" and enters command state.
  229.         This means that this "RING" string will cause your modem to 
  230.         hang up before making a connection to the remote modem.  Also,
  231.         if your modem doesn't exhibit the strange behavior of "hanging
  232.         up" right as the connection is getting started, then it will
  233.         still have the problem of the first user to the "getty"
  234.         process running on the port will have the name "RING".  So
  235.         the long answer is... set command response to only respond to
  236.         local commands.  On the HAYES "V-Series" modems the "Q"
  237.         register handles this.  I have found that a setting of:
  238.         "ATQ2" works fine.
  239.  
  240.     Flow control should be set according to the desired programs
  241.         that you will be using.  For most instances, if you are going
  242.         to be doing any kind of file transfers, you will need to make
  243.         sure that you are NOT using "XON/XOFF" flow control (the
  244.         same caveat applies to the serial port setup as well).  UUCP
  245.         and xmodem for example use a form of checksumming or CRC 
  246.         error control, and these "checksums" or "CRC" values are 
  247.         binary numbers -- meaning they can take the form of ANY 
  248.         ASCII character sequence -- including the ^S and/or ^Q used
  249.         for XON/XOFF flow control.  UUCP and xmodem will not usually 
  250.         work with XON/XOFF (if they do work, it just means that the
  251.         files you happened to transfer didn't cause a "checksum" or
  252.         "CRC" value that matched the XON or XOFF characters).  What 
  253.         happens is this: one system (either modem or serial port) is
  254.         receiving data, and responding with a CRC.  The receiver gets
  255.         a packet of information that CRC's to include the binary value
  256.         of '^Q'.  This CRC is sent to the remote system.  The device 
  257.         that expects "XON/XOFF" flow control sees the '^Q' as a flow 
  258.         control character, and assumes that it was not intended to be
  259.         in the data stream; so it strips it out of the incomming data.
  260.         Then, the system that was sending the packet receives the CRC
  261.         (minus the bits that made up the '^Q') and thinks that it has
  262.         received an invalid CRC, so it resends the packet (which will
  263.         still have the SAME CRC value).  For most connections you will
  264.         either need to use RTS/CTS flow control, or "NONE" for flow
  265.         control.  (On UUCP and Xmodem file transfers flow control is
  266.         not required, the size of the packets that each program sends is
  267.         small enough that you don't have to worry about overrunning the
  268.         receive speed of the remote systems serial line).  On the IBM RT
  269.         product "RTS/CTS" flow is not supported, so you must use "NONE"
  270.         for any type of file transfer software.  On the RS/6000 the "RTS"
  271.         line discipline can be set, but setting it is cumbersome (at
  272.         least on the current release of AIX v.3.1), so it is usually
  273.         easier to use "NONE" on this machine as well.  Use the following
  274.         list for the HAYES "V-series" modems to determine how to set up
  275.         specific flow control methods:
  276.  
  277.         XON/XOFF    AT&K4
  278.  
  279.         RTS/CTS        AT&K3
  280.  
  281.         NONE        AT&K0
  282.  
  283.         (By the way, it doesn't hurt to set "RTS/CTS" flow control
  284.         on the modem even if the computer is not using any flow 
  285.         control.)
  286.         
  287.  
  288. By and large, these settings should allow you setup reliable  
  289. uni/bi-directional
  290. modem connections for the IBM RS/6000 and RT products.  If they don't help,  
  291. or
  292. if I have left something out, please mail me a note and I will add the info  
  293. to
  294. the next revision of this guide. 
  295.  
  296. NOTE: The "SHARE" and "DELAY" settings for the tty setup on the RS/6000 don't
  297. work correctly until the 3003 update.  Make sure that you have at least the
  298. 3003 update on the RS/6000 before attempting to use "bi-directional" modem
  299. lines, or you will have alot of headaches.
  300.  
  301. Additional NOTE: Versions of AIX prior to 3.1 update 3008 still have MANY  
  302. known serial problems.  I suggest you update to 3.2 before declaring anything  
  303. as "broken".
  304.  
  305. --
  306. +---------------------------------------------------------------------------+
  307. |These are MY views, nobody where I work even knows I have views  ;-)       |
  308. |Internet: robin@pencom.com                                                 |
  309. |US Mail:  8-6 Brooke Club Dr.                Home Phone: (914) 923-4093    |
  310. |          Ossining, NY  10562                Work Phone: (212) 513-7777    |
  311. +---------------------------------------------------------------------------+
  312.