From: robin@pencom.com (Robin D. Wilson)
Subject: Re: High-speed modem at built-in serial port (RS/6000)
Reply-To: robin@pencom.com
Organization: Pencom Systems Incorporated
Date: Thu, 10 Sep 1992 17:15:33 GMT

In article <BtpJy7.92L@well.sf.ca.us> nlane@well.sf.ca.us (Nathan D. Lane)  
writes:
> On AIX 3.2, the hardware flow control settings DO NOT hold between reboots.
> Caused me all sorts of nightmares.  There is an unsupported fix out there, 
> but it is so unsupported that it doesn't even have a number and I got it 
> w/hand-written instructions on the disk.  Call defect support and mention 
> that your rts/cts settings are not kept up between reboots.

I wouldn't call this a "fix" simply because it is unsupported.  It is a  
"work-around".  Nonetheless, I received the above mentioned fix from Defect  
Support, and parlayed that into the following program (the only thing that I  
stole from IBM is the specifc "ioctl()" call to use to turn on 'rts' line  
dicipline):

-----------------------CUT HERE-------------------------------------------

/* This program is an adaptation of a program provided by IBM Defect Support.
   It is provided without warrantee, or support.
   The syntax of the command is:

	setrts tty [tty [tty [...]]]

   The program will loop through each tty provided on the command line, and 
   turn on the 'rts' line dicipline.  The program does not require that
   the Carrier Detect signal be held high to keep the serial device from 
   blocking on the attempt to open it.  The program works for all valid ttys.

   BUGS: None that are known; however, using the program to set 'ptys' may
   cause the 'pty' to become unusable.


   This program was written by Robin D. Wilson, Pencom Software (with the
   specific 'ioctl()' call provided by the IBM Defect Support Center.

   I call it: "setrts"

   I put the following line in my "/etc/inittab" file so that 'rts' will be
   turned on every time my machine boots:

   setrts:2:once:/local/bin/setrts tty0 tty1 tty<nnn>

   Seems to work like a charm...
*/

#include <stdio.h>
#include <fcntl.h>
#include <termios.h>
#include <sys/tty.h>
#include <string.h>
#include <sys/param.h>

main (argc, argv)
int argc;
char **argv;
{
	int tty;
	char ttyname[MAXPATHLEN];

	if (argc < 2) {
		fprintf(stderr, "usage: %s <tty_device>\n", argv[0]);
		exit(-1);
	}

	else while (--argc >= 1) {
		argv++;

		if (strncmp("/dev/", argv[0], 5) != 0) {
			strcpy(ttyname,"/dev/");
			strcat(ttyname,argv[0]);
		}
		else
			strcpy(ttyname,argv[0]);

		if ((tty = open(ttyname, O_RDWR|O_NDELAY)) < 0) {
			fprintf(stderr, "%s: couldn't open tty device.\n",  
ttyname);
			exit (-3);
		}

		(void)ioctl(tty, TXADDCD, "rts");
	}
}
-------------------------END OF PROGRAM------------------------------

--
+---------------------------------------------------------------------------+
|These are MY views, nobody where I work even knows I have views  ;-)       |
|Internet: robin@pencom.com                                                 |
|US Mail:  8-6 Brooke Club Dr.                Home Phone: (914) 923-4093    |
|          Ossining, NY  10562                Work Phone: (212) 513-7777    |
+---------------------------------------------------------------------------+