]> git.ozlabs.org Git - ppp.git/commitdiff
pppd: Add option "stop-bits" to set number of serial port stop bits.
authorCraig McQueen <craig.mcqueen@beamcommunications.com>
Mon, 30 Sep 2013 05:01:20 +0000 (15:01 +1000)
committerCraig McQueen <craig.mcqueen@beamcommunications.com>
Tue, 18 Feb 2014 23:56:11 +0000 (10:56 +1100)
This allows for configuring the serial device for 2 stop bits (default is 1 stop bit).

Signed-off-by: Craig McQueen <craig.mcqueen@beamcommunications.com>
pppd/pppd.h
pppd/sys-linux.c
pppd/sys-solaris.c
pppd/tty.c

index 47e4d9ad40c36e692b97be97d268116fb8b0ef46..873b832598f7351c8aece87d09bcc5fced68ec68 100644 (file)
@@ -279,6 +279,7 @@ extern int  kdebugflag;     /* Tell kernel to print debug messages */
 extern int     default_device; /* Using /dev/tty or equivalent */
 extern char    devnam[MAXPATHLEN];     /* Device name */
 extern int     crtscts;        /* Use hardware flow control */
+extern int     stop_bits;      /* Number of serial port stop bits */
 extern bool    modem;          /* Use modem control lines */
 extern int     inspeed;        /* Input/Output speed requested */
 extern u_int32_t netmask;      /* IP netmask to set on interface */
index 72a7727c403f79762a93bf1342e3b02aa869c27a..163f5618582c109fd68c45d0b8392a745b44d234 100644 (file)
@@ -966,6 +966,9 @@ void set_up_tty(int tty_fd, int local)
        break;
     }
 
+    if (stop_bits >= 2)
+       tios.c_cflag |= CSTOPB;
+
     speed = translate_speed(inspeed);
     if (speed) {
        cfsetospeed (&tios, speed);
index 50ce3dfac2d39a28e1ba26a3e5175f6bc0a73388..93d90332e0d4f2116b17800970e082cf193640dd 100644 (file)
@@ -1225,6 +1225,9 @@ set_up_tty(fd, local)
     }
 #endif
 
+    if (stop_bits >= 2)
+       tios.c_cflag |= CSTOPB;
+
     tios.c_cflag |= CS8 | CREAD | HUPCL;
     if (local || !modem)
        tios.c_cflag |= CLOCAL;
index d571b111d7e34755d9304104c075dcbcc16f4e44..c9a0b33715bc829a7dae446f5f5e1b29d1d78e26 100644 (file)
@@ -136,6 +136,7 @@ struct stat devstat;                /* result of stat() on devnam */
 
 /* option variables */
 int    crtscts = 0;            /* Use hardware flow control */
+int    stop_bits = 1;          /* Number of serial port stop bits */
 bool   modem = 1;              /* Use modem control lines */
 int    inspeed = 0;            /* Input/Output speed requested */
 bool   lockflag = 0;           /* Create lock file to lock the serial dev */
@@ -221,6 +222,9 @@ option_t tty_options[] = {
       OPT_PRIOSUB | OPT_ALIAS | OPT_NOARG | OPT_VAL(-1) },
     { "xonxoff", o_special_noarg, (void *)setxonxoff,
       "Set software (XON/XOFF) flow control", OPT_PRIOSUB },
+    { "stop-bits", o_int, &stop_bits,
+      "Number of stop bits in serial port",
+      OPT_PRIO | OPT_PRIVFIX | OPT_LIMITS, NULL, 2, 1 },
 
     { "modem", o_bool, &modem,
       "Use modem control lines", OPT_PRIO | 1 },