home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / aix / 9559 < prev    next >
Encoding:
Text File  |  1992-09-10  |  3.4 KB  |  104 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 built-in serial port (RS/6000)
  5. Message-ID: <1992Sep10.171533.22717@psisa.psi>
  6. Sender: usenet@psisa.psi (News system)
  7. Reply-To: robin@pencom.com
  8. Organization: Pencom Systems Incorporated
  9. References: <BtpJy7.92L@well.sf.ca.us>
  10. Date: Thu, 10 Sep 1992 17:15:33 GMT
  11. Lines: 91
  12.  
  13. In article <BtpJy7.92L@well.sf.ca.us> nlane@well.sf.ca.us (Nathan D. Lane)  
  14. writes:
  15. > On AIX 3.2, the hardware flow control settings DO NOT hold between reboots.
  16. > Caused me all sorts of nightmares.  There is an unsupported fix out there, 
  17. > but it is so unsupported that it doesn't even have a number and I got it 
  18. > w/hand-written instructions on the disk.  Call defect support and mention 
  19. > that your rts/cts settings are not kept up between reboots.
  20.  
  21. I wouldn't call this a "fix" simply because it is unsupported.  It is a  
  22. "work-around".  Nonetheless, I received the above mentioned fix from Defect  
  23. Support, and parlayed that into the following program (the only thing that I  
  24. stole from IBM is the specifc "ioctl()" call to use to turn on 'rts' line  
  25. dicipline):
  26.  
  27. -----------------------CUT HERE-------------------------------------------
  28.  
  29. /* This program is an adaptation of a program provided by IBM Defect Support.
  30.    It is provided without warrantee, or support.
  31.    The syntax of the command is:
  32.  
  33.     setrts tty [tty [tty [...]]]
  34.  
  35.    The program will loop through each tty provided on the command line, and 
  36.    turn on the 'rts' line dicipline.  The program does not require that
  37.    the Carrier Detect signal be held high to keep the serial device from 
  38.    blocking on the attempt to open it.  The program works for all valid ttys.
  39.  
  40.    BUGS: None that are known; however, using the program to set 'ptys' may
  41.    cause the 'pty' to become unusable.
  42.  
  43.  
  44.    This program was written by Robin D. Wilson, Pencom Software (with the
  45.    specific 'ioctl()' call provided by the IBM Defect Support Center.
  46.  
  47.    I call it: "setrts"
  48.  
  49.    I put the following line in my "/etc/inittab" file so that 'rts' will be
  50.    turned on every time my machine boots:
  51.  
  52.    setrts:2:once:/local/bin/setrts tty0 tty1 tty<nnn>
  53.  
  54.    Seems to work like a charm...
  55. */
  56.  
  57. #include <stdio.h>
  58. #include <fcntl.h>
  59. #include <termios.h>
  60. #include <sys/tty.h>
  61. #include <string.h>
  62. #include <sys/param.h>
  63.  
  64. main (argc, argv)
  65. int argc;
  66. char **argv;
  67. {
  68.     int tty;
  69.     char ttyname[MAXPATHLEN];
  70.  
  71.     if (argc < 2) {
  72.         fprintf(stderr, "usage: %s <tty_device>\n", argv[0]);
  73.         exit(-1);
  74.     }
  75.  
  76.     else while (--argc >= 1) {
  77.         argv++;
  78.  
  79.         if (strncmp("/dev/", argv[0], 5) != 0) {
  80.             strcpy(ttyname,"/dev/");
  81.             strcat(ttyname,argv[0]);
  82.         }
  83.         else
  84.             strcpy(ttyname,argv[0]);
  85.  
  86.         if ((tty = open(ttyname, O_RDWR|O_NDELAY)) < 0) {
  87.             fprintf(stderr, "%s: couldn't open tty device.\n",  
  88. ttyname);
  89.             exit (-3);
  90.         }
  91.  
  92.         (void)ioctl(tty, TXADDCD, "rts");
  93.     }
  94. }
  95. -------------------------END OF PROGRAM------------------------------
  96.  
  97. --
  98. +---------------------------------------------------------------------------+
  99. |These are MY views, nobody where I work even knows I have views  ;-)       |
  100. |Internet: robin@pencom.com                                                 |
  101. |US Mail:  8-6 Brooke Club Dr.                Home Phone: (914) 923-4093    |
  102. |          Ossining, NY  10562                Work Phone: (212) 513-7777    |
  103. +---------------------------------------------------------------------------+
  104.