add support for CDTRCTS flow control

This commit is contained in:
Christos Zoulas 1998-09-04 18:49:16 +00:00
parent 6328c84937
commit 44e1777caa
3 changed files with 62 additions and 14 deletions

View File

@ -18,7 +18,7 @@
*/
#ifndef lint
static char rcsid[] = "$Id: options.c,v 1.42 1998/03/26 04:46:06 paulus Exp $";
static char rcsid[] = "$Id: options.c,v 1.43 1998/09/04 18:49:15 christos Exp $";
#endif
#include <ctype.h>
@ -171,6 +171,7 @@ static int setdomain __P((char **));
static int setnetmask __P((char **));
static int setcrtscts __P((char **));
static int setnocrtscts __P((char **));
static int setcdtrcts __P((char **));
static int setxonxoff __P((char **));
static int setnodetach __P((char **));
static int setupdetach __P((char **));
@ -311,6 +312,9 @@ static struct cmd {
{"crtscts", 0, setcrtscts}, /* set h/w flow control */
{"nocrtscts", 0, setnocrtscts}, /* clear h/w flow control */
{"-crtscts", 0, setnocrtscts}, /* clear h/w flow control */
{"cdtrcts", 0, setcdtrcts}, /* set alternate h/w flow control */
{"nocdtrcts", 0, setnocrtscts}, /* clear h/w flow control */
{"-cdtrcts", 0, setnocrtscts}, /* clear h/w flow control */
{"xonxoff", 0, setxonxoff}, /* set s/w flow control */
{"debug", 0, setdebug}, /* Increase debugging level */
{"kdebug", 1, setkdebug}, /* Enable kernel-level debugging */
@ -435,6 +439,7 @@ Usage: %s [ options ], where options are:\n\
auth Require authentication from peer\n\
connect <p> Invoke shell command <p> to set up the serial line\n\
crtscts Use hardware RTS/CTS flow control\n\
cdtrcts Use hardware DTR/CTS flow control (if supported)\n\
defaultroute Add default route through interface\n\
file <f> Take options from file <f>\n\
modem Use modem control lines\n\
@ -1853,6 +1858,14 @@ setnocrtscts(argv)
return (1);
}
static int
setcdtrcts(argv)
char **argv;
{
crtscts = 2;
return (1);
}
static int
setxonxoff(argv)
char **argv;

View File

@ -1,5 +1,5 @@
.\" manual page [] for pppd 2.3
.\" $Id: pppd.8,v 1.27 1998/03/31 04:31:08 paulus Exp $
.\" $Id: pppd.8,v 1.28 1998/09/04 18:49:15 christos Exp $
.\" SH section heading
.\" SS subsection heading
.\" LP paragraph
@ -92,10 +92,29 @@ program to dial the modem and start the remote ppp session. This
option is privileged if the \fInoauth\fR option is used.
.TP
.B crtscts
Use hardware flow control (i.e. RTS/CTS) to control the flow of data
on the serial port. If neither the \fIcrtscts\fR nor the
\fInocrtscts\fR option is given, the hardware flow control setting
for the serial port is left unchanged.
Use hardware flow control (i.e. RTS/CTS) to control the flow of
data on the serial port. If neither the \fIcrtscts\fR, the
\fInocrtscts\fR, the \fIcdtrcts\fR nor the \fInocdtrcts\fR option
is given, the hardware flow control setting for the serial port is
left unchanged.
Some serial ports (such as Macintosh serial ports) lack a true
RTS output. Such serial ports use this mode to impliment
unidirectional flow control. The serial port will
suspend transmission when requested by the modem (via CTS)
but will be unable to request the modem stop sending to the
computer. This mode retains the ability to use DTR as
a modem control line.
.TP
.B cdtrcts
Use a non-standard hardware flow control (i.e. DTR/CTS) to control
the flow of data on the serial port. If neither the \fIcrtscts\fR,
the \fInocrtscts\fR, the \fIcdtrcts\fR nor the \fInocdtrcts\fR
option is given, the hardware flow control setting for the serial
port is left unchanged.
Some serial ports (such as Macintosh serial ports) lack a true
RTS output. Such serial ports use this mode to impliment true
bi-directional flow control. The sacrafice is that this flow
control mode does not permit using DTR as a modem control line.
.TP
.B defaultroute
Add a default route to the system routing tables, using the peer as
@ -469,10 +488,14 @@ should only be required if the peer is buggy and gets confused by
requests from pppd for CCP negotiation.
.TP
.B nocrtscts
Disable hardware flow control (i.e. RTS/CTS) on the serial port. If
neither the \fIcrtscts\fR nor the \fInocrtscts\fR option is given,
the hardware flow control setting for the serial port is left
unchanged.
Disable hardware flow control (i.e. RTS/CTS) on the serial port.
If neither the \fIcrtscts\fR nor the \fInocrtscts\fR nor the
\fIcdtrcts\fR nor the \fInodtrcts\fR option is given, the hardware
flow control setting for the serial port is left unchanged.
.TP
.B nodtrcts
This option is a synonym for \fInocrtscts\fR. Either of these options will
disable both forms of hardware flow control.
.TP
.B nodefaultroute
Disable the \fIdefaultroute\fR option. The system administrator who

View File

@ -21,7 +21,7 @@
*/
#ifndef lint
static char rcsid[] = "$Id: sys-bsd.c,v 1.32 1998/09/02 20:58:13 christos Exp $";
static char rcsid[] = "$Id: sys-bsd.c,v 1.33 1998/09/04 18:49:16 christos Exp $";
/* $NetBSD: sys-bsd.c,v 1.1.1.3 1997/09/26 18:53:04 christos Exp $ */
#endif
@ -385,10 +385,22 @@ set_up_tty(fd, local)
}
tios.c_cflag &= ~(CSIZE | CSTOPB | PARENB | CLOCAL);
if (crtscts > 0 && !local)
if (crtscts > 0 && !local) {
if (crtscts == 2) {
#ifdef CDTRCTS
tios.c_cflag |= CDTRCTS;
#else
syslog(LOG_ERR, "System does not support DTR/CTS flow control");
die(1);
#endif
} else
tios.c_cflag |= CRTSCTS;
else if (crtscts < 0)
} else if (crtscts < 0) {
tios.c_cflag &= ~CRTSCTS;
#ifdef CDTRCTS
tios.c_cflag &= ~CDTRCTS;
#endif
}
tios.c_cflag |= CS8 | CREAD | HUPCL;
if (local || !modem)