RTS/CTS flow control (AIX V3)
Russell A. Heise
RAH at IBM.COM
Thu Oct 11 00:27:46 AEST 1990
kevin at msa3b.UUCP (Kevin P. Kleinfelter) writes:
> How does one enable/disable RTS/CTS flow control on a tty line using
> AIX V3, from a C program? The only info provided by "info" is that
> "stty add rts" can be issued from the shell level.
>
> I have issued "stty add rts" from the shell, then entered a C program that
> puts the terminal in raw mode, and it appears that RTS/CTS flow control
> is not enabled. That is to say, a line monitor shows that data is
> received, RTS is not dropped, yet the last few bytes of the data are
> not returned by a "read" in my code.
An associate offers the following sample program:
--- cut here
#include <termios.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/errno.h>
#include <fnctl.h>
#define MODEM_LINE "/dev/tty1"
main()
LB <== LB is left brace, RB is right brace
int linefd;
linefd = open (MODEM_LINE, O_RDWR);
if (linefd == -1)
printf ("Can't open line - errno %d\n", errno);
else
while (1) LB
printf ("Drop RTS now\n");
ioctl (linefd, TIOCMBIC, TIOCM_RTS);
sleep (2);
printf ("Raise RTS now\n");
ioctl (linefd, TIOCMBIS, TIOCM_RTS);
sleep (2);
RB
RB <== supposed to be a right brace
--- end cut here
Of course, this code is offered without warranty. Hope it helps.
Russ Heise, AIX Technical Support, IBM
More information about the Comp.unix.aix
mailing list