Skip to content

Commit 474bab9

Browse files
committed
aio: tty: Add support for vstart and vstop
xonxoff start and stop chars Signed-off-by: Steve Bennett <[email protected]>
1 parent dd22498 commit 474bab9

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

jim-aio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2145,7 +2145,7 @@ static const jim_subcmd_type aio_command_table[] = {
21452145
#endif
21462146
#if defined(HAVE_TERMIOS_H)
21472147
{ "tty",
2148-
"?baud rate? ?data bits? ?stop bits? ?parity even|odd|none? ?handshake xonxoff|rtscts|none? ?input raw|cooked? ?output raw|cooked? ?echo 0|1? ?vmin n? ?vtime n?",
2148+
"?baud rate? ?data bits? ?stop bits? ?parity even|odd|none? ?handshake xonxoff|rtscts|none? ?input raw|cooked? ?output raw|cooked? ?echo 0|1? ?vmin n? ?vtime n? ?vstart char? ?vstop char?",
21492149
aio_cmd_tty,
21502150
0,
21512151
-1,

jim-tty.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ static const char * const tty_settings_names[] = {
7979
"vmin",
8080
"vtime",
8181
"echo",
82+
"vstart",
83+
"vstop",
8284
NULL
8385
};
8486

@@ -92,7 +94,9 @@ enum {
9294
OPT_STOP,
9395
OPT_VMIN,
9496
OPT_VTIME,
95-
OPT_ECHO
97+
OPT_ECHO,
98+
OPT_VSTART,
99+
OPT_VSTOP,
96100
};
97101

98102

@@ -184,6 +188,10 @@ Jim_Obj *Jim_GetTtySettings(Jim_Interp *interp, int fd)
184188
Jim_ListAppendElement(interp, listObjPtr, Jim_NewIntObj(interp, tio.c_cc[VMIN]));
185189
Jim_ListAppendElement(interp, listObjPtr, Jim_NewStringObj(interp, "vtime", -1));
186190
Jim_ListAppendElement(interp, listObjPtr, Jim_NewIntObj(interp, tio.c_cc[VTIME]));
191+
Jim_ListAppendElement(interp, listObjPtr, Jim_NewStringObj(interp, "vstart", -1));
192+
Jim_ListAppendElement(interp, listObjPtr, Jim_NewIntObj(interp, tio.c_cc[VSTART]));
193+
Jim_ListAppendElement(interp, listObjPtr, Jim_NewStringObj(interp, "vstop", -1));
194+
Jim_ListAppendElement(interp, listObjPtr, Jim_NewIntObj(interp, tio.c_cc[VSTOP]));
187195

188196
speed = cfgetispeed(&tio);
189197
baud = 0;
@@ -283,17 +291,18 @@ int Jim_SetTtySettings(Jim_Interp *interp, int fd, Jim_Obj *dictObjPtr)
283291
break;
284292

285293
case OPT_VMIN:
286-
if (Jim_GetLong(interp, valueObj, &l) != JIM_OK) {
287-
goto badvalue;
288-
}
289-
tio.c_cc[VMIN] = l;
290-
break;
291-
292294
case OPT_VTIME:
295+
case OPT_VSTART:
296+
case OPT_VSTOP:
293297
if (Jim_GetLong(interp, valueObj, &l) != JIM_OK) {
294298
goto badvalue;
295299
}
296-
tio.c_cc[VTIME] = l;
300+
switch (opt) {
301+
case OPT_VMIN: tio.c_cc[VMIN] = l; break;
302+
case OPT_VTIME: tio.c_cc[VTIME] = l; break;
303+
case OPT_VSTART: tio.c_cc[VSTART] = l; break;
304+
case OPT_VSTOP: tio.c_cc[VSTOP] = l; break;
305+
}
297306
break;
298307

299308
case OPT_OUTPUT:

jim_tcl.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5173,6 +5173,12 @@ This command returns an empty string.
51735173
+*vtime* 'time'+;;
51745174
Timeout for noncanonical read (units of 0.1 seconds)
51755175

5176+
+*vstart* 'char'+;;
5177+
Start character for xonoff, usually 0x11 (^Q)
5178+
5179+
+*vstop* 'char'+;;
5180+
Stop character for xonoff, usually 0x13 (^S)
5181+
51765182
+$handle *ssl* ?*-server* 'cert ?key?'|*-sni* 'servername'?+::
51775183
Upgrades the stream to a SSL/TLS session and returns the handle.
51785184
If +-server+ is specified, either both the certificate and private key files

tests/tty.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ test tty-1.1 {tty status} {
2525

2626
test tty-1.2 {tty bad param} -body {
2727
$chan tty bad value
28-
} -returnCodes error -result {bad setting "bad": must be baud, data, echo, handshake, input, output, parity, stop, vmin, or vtime}
28+
} -returnCodes error -result {bad setting "bad": must be baud, data, echo, handshake, input, output, parity, stop, vmin, vstart, vstop, or vtime}
2929

3030
test tty-1.3 {tty bad baud} -body {
3131
$chan tty baud 12345

0 commit comments

Comments
 (0)