Make CRTSTS selection a runtime option. Closes PR#1392

Submitted by:	Mike McGaughey <mmcg@heraclitus.cs.monash.edu.au>
This commit is contained in:
Jordan K. Hubbard 1996-12-22 17:09:17 +00:00
parent dbab5e88a6
commit 17e762ca3d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=20812
7 changed files with 76 additions and 28 deletions

View file

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: command.c,v 1.24 1996/10/13 15:05:14 sos Exp $
* $Id: command.c,v 1.25 1996/12/03 21:38:39 nate Exp $
*
*/
#include <sys/types.h>
@ -949,6 +949,23 @@ int param;
return(1);
}
static int SetCtsRts(list, argc, argv)
struct cmdtab *list;
int argc;
char **argv;
{
if (argc > 0) {
if (strcmp(*argv, "on") == 0)
VarCtsRts = TRUE;
else if (strcmp(*argv, "off") == 0)
VarCtsRts = FALSE;
else
printf("usage: set ctsrts [on|off].\n");
}
return(1);
}
static int SetOpenMode(list, argc, argv)
struct cmdtab *list;
int argc;
@ -979,6 +996,8 @@ struct cmdtab const SetCommands[] = {
"Set authentication key", "key", (void *)VAR_AUTHKEY},
{ "authname", NULL, SetVariable, LOCAL_AUTH,
"Set authentication name", "name", (void *)VAR_AUTHNAME},
{ "ctsrts", NULL, SetCtsRts, LOCAL_AUTH,
"Use CTS/RTS modem signalling", "[on|off]"},
{ "debug", NULL, SetDebugLevel, LOCAL_AUTH,
"Set debug level", StrValue},
{ "device", "line", SetVariable, LOCAL_AUTH,

View file

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: defs.h,v 1.5 1996/12/03 21:38:42 nate Exp $
* $Id: defs.h,v 1.6 1996/12/12 14:39:39 jkh Exp $
*
* TODO:
*/
@ -45,6 +45,7 @@
#define MODEM_SPEED B38400 /* tty speed */
#define SERVER_PORT 3000 /* Base server port no. */
#define MODEM_CTSRTS TRUE /* Default (true): use CTS/RTS signals */
#define REDIAL_PERIOD 30 /* Default Hold time to redial */
#define CONFFILE "ppp.conf"

View file

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: modem.c,v 1.23 1996/03/29 15:24:04 ache Exp $
* $Id: modem.c,v 1.24 1996/05/11 20:48:36 phk Exp $
*
* TODO:
*/
@ -39,7 +39,6 @@
#define O_NONBLOCK O_NDELAY
#endif
#endif
#define USE_CTSRTS
extern int DoChat();
@ -448,12 +447,12 @@ int mode;
rstio.c_iflag, rstio.c_oflag, rstio.c_cflag);
#endif
cfmakeraw(&rstio);
#ifdef USE_CTSRTS
if (VarCtsRts)
rstio.c_cflag |= CLOCAL | CCTS_OFLOW|CRTS_IFLOW;
#else
else {
rstio.c_cflag |= CLOCAL;
rstio.c_iflag |= IXOFF;
#endif
}
rstio.c_iflag |= IXON;
if (!(mode & MODE_DEDICATED))
rstio.c_cflag |= HUPCL;
@ -516,11 +515,11 @@ int modem;
}
tcgetattr(modem, &rstio);
cfmakeraw(&rstio);
#ifdef USE_CTSRTS
if (VarCtsRts)
rstio.c_cflag |= CLOCAL | CCTS_OFLOW|CRTS_IFLOW;
#else
else
rstio.c_cflag |= CLOCAL;
#endif
if (!(mode & MODE_DEDICATED))
rstio.c_cflag |= HUPCL;
tcsetattr(modem, TCSADRAIN, &rstio);
@ -772,11 +771,14 @@ ShowModemStatus()
}
if (VarParity & PARENB) {
if (VarParity & PARODD)
printf("odd parity\n");
printf("odd parity, ");
else
printf("even parity\n");
printf("even parity, ");
} else
printf("none parity\n");
printf("no parity, ");
printf("CTS/RTS %s.\n", (VarCtsRts? "on" : "off"));
#ifdef DEBUG
printf("fd = %d, modem control = %o\n", modem, mbits);
#endif

View file

@ -1,5 +1,5 @@
.\" manual page [] for ppp 0.94 beta2 + alpha
.\" $Id: ppp.8,v 1.20 1996/12/03 21:38:52 nate Exp $
.\" $Id: ppp.8,v 1.21 1996/12/12 14:39:47 jkh Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -172,8 +172,18 @@ ppp on tama> pass <password>
ppp ON tama>
* You can specify the device name and speed for your modem using the
following commands: *
* You can now specify the device name, speed and parity
for your modem, and whether
CTS/RTS signalling should be used (CTS/RTS is used by default).
If your hardware does not provide CTS/RTS lines (as
may happen when you are connected directly to certain ppp-capable
terminal servers),
.Nm
will never send any output through the port; it
waits for a signal which never comes.
Thus, if you have a direct line and can't seem to make
a connection, try turning ctsrts off: *
ppp ON tama> set line /dev/cuaa0
@ -181,6 +191,8 @@ ppp ON tama> set speed 38400
ppp ON tama> set parity even
ppp ON tama> set ctsrts on
ppp ON tama> show modem
* Modem related parameters are shown in here *

View file

@ -1,5 +1,5 @@
.\" manual page [] for ppp 0.94 beta2 + alpha
.\" $Id: ppp.8,v 1.20 1996/12/03 21:38:52 nate Exp $
.\" $Id: ppp.8,v 1.21 1996/12/12 14:39:47 jkh Exp $
.Dd 20 September 1995
.Os FreeBSD
.Dt PPP 8
@ -172,8 +172,18 @@ ppp on tama> pass <password>
ppp ON tama>
* You can specify the device name and speed for your modem using the
following commands: *
* You can now specify the device name, speed and parity
for your modem, and whether
CTS/RTS signalling should be used (CTS/RTS is used by default).
If your hardware does not provide CTS/RTS lines (as
may happen when you are connected directly to certain ppp-capable
terminal servers),
.Nm
will never send any output through the port; it
waits for a signal which never comes.
Thus, if you have a direct line and can't seem to make
a connection, try turning ctsrts off: *
ppp ON tama> set line /dev/cuaa0
@ -181,6 +191,8 @@ ppp ON tama> set speed 38400
ppp ON tama> set parity even
ppp ON tama> set ctsrts on
ppp ON tama> show modem
* Modem related parameters are shown in here *

View file

@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: vars.c,v 1.8 1996/10/06 13:32:36 jkh Exp $
* $Id: vars.c,v 1.9 1996/10/06 19:39:08 jkh Exp $
*
*/
#include "fsm.h"
@ -29,7 +29,7 @@
#include "defs.h"
char VarVersion[] = "Version 0.94";
char VarLocalVersion[] = "$Date: 1996/10/06 13:32:36 $";
char VarLocalVersion[] = "$Date: 1996/10/06 19:39:08 $";
/*
* Order of conf option is important. See vars.h.
@ -49,7 +49,7 @@ struct confdesc pppConfs[] = {
};
struct pppvars pppVars = {
DEF_MRU, 0, MODEM_SPEED, CS8, 180, 30, 3,
DEF_MRU, 0, MODEM_SPEED, CS8, MODEM_CTSRTS, 180, 30, 3,
REDIAL_PERIOD, 1, MODEM_DEV, OPEN_PASSIVE, LOCAL_NO_AUTH,
};

View file

@ -15,7 +15,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id: vars.h,v 1.6 1996/03/08 13:22:23 ache Exp $
* $Id: vars.h,v 1.7 1996/10/06 13:32:37 jkh Exp $
*
* TODO:
*/
@ -58,6 +58,7 @@ struct pppvars {
int var_accmap; /* Initial ACCMAP value */
int modem_speed; /* Current modem speed */
int modem_parity; /* Parity setting */
int modem_ctsrts; /* Use CTS/RTS on modem port? (boolean) */
int idle_timeout; /* Idle timeout value */
int lqr_timeout; /* LQR timeout value */
int retry_timeout; /* Retry timeout value */
@ -85,6 +86,7 @@ struct pppvars {
#define VarDevice pppVars.modem_dev
#define VarSpeed pppVars.modem_speed
#define VarParity pppVars.modem_parity
#define VarCtsRts pppVars.modem_ctsrts
#define VarOpenMode pppVars.open_mode
#define VarLocalAuth pppVars.lauth
#define VarDialScript pppVars.dial_script