Next: Termios port interface, Previous: Termios introduction, Up: The termios and miscellaneous library [Contents][Index]
The #<termios> type is an opaque type that can contain
information about a general terminal interface. This information
is in the form of several boolean
This procedure creates and returns a new #<termios> variable.
A newly created #<termios> do not represent any specific port’s
behavior. It is set to a generic behavior for a raw terminal: no
echoing or special processing and with 8-bit characters allowed.
This procedure returns #t if x is of the
#<termios> type./
This procedure, when given term of type #<termios>, writes
to the standard output port some useful debugging information about
the current state of term.
Given term of type #<termios> and flag-or-flags
which is either a symbol or a list of symbols of termios boolean properties,
this procedure sets those properties to be active.
Given term of type #<termios> and flag-or-flags
which is either a symbol or a list of symbols of termios boolean properties,
this procedure sets those properties to be disabled.
Given term of type #<termios>, this returns a list of
symbols of the boolean properties of term that are active.
Given term of type #<termios>, and prop, which is a
symbol indicating a boolean property of term, this returns
#t if that property is set, or #f otherwise.
The boolean properties are in the table below.
IGNBRKIgnore a BREAK condition on input.
BRKINTIf IGNBRK is set, a BREAK is ignored. If it is not set but BRKINT is set, then a BREAK causes the input and output queues to be flushed, and if the terminal is the controlling terminal of a foreground process group, it will cause a SIGINT to be sent to this foreground process group. When neither IGNBRK nor BRKINT are set, a BREAK reads as a null byte (’0円’), except when PARMRK is set, in which case it reads as the sequence 377円 0円 0円.
IGNPARIgnore framing errors and parity errors.
PARMRKIf this bit is set, input bytes with parity or framing errors are marked when passed to the program. This bit is meaningful only when INPCK is set and IGNPAR is not set. The way erroneous bytes are marked is with two preceding bytes, 377円 and 0円. Thus, the program actually reads three bytes for one erroneous byte received from the terminal. If a valid byte has the value 377,円 and ISTRIP (see below) is not set, the program might confuse it with the prefix that marks a parity error. Therefore, a valid byte 377円 is passed to the program as two bytes, 377円 377,円 in this case.
If neither IGNPAR nor PARMRK is set, read a character with a parity error or framing error as 0円.
INPCKEnable input parity checking.
ISTRIPStrip off eighth bit.
INLCRTranslate NL to CR on input.
IGNCRIgnore carriage return on input.
ICRNLTranslate carriage return to newline on input (unless IGNCR is set).
IXONEnable XON/XOFF flow control on output.
IXANYTyping any character will restart stopped output. (The default is to allow just the START character to restart output.)
IXOFFEnable XON/XOFF flow control on input.
OPOSTEnable output postprocessing.
ONLCRIf OPOST is set, map NL to CR-NL on output.
OCRNLIf OPOST is set, map CR to NL on output.
ONOCRIf OPOST is set, don’t output CR at column 0.
ONLRETIf OPOST is set, NL is assumed to do the carriage return function. Carriage returns are not emitted.
CSTOPBSet two stop bits, rather than one.
CREADEnable receiver.
PARENBEnable parity generation on output and parity checking for input.
PARODDIf set, then parity for input and output is odd; otherwise even parity is used.
HUPCLLower modem control lines after last process closes the device (hang up).
CLOCALIgnore modem control lines.
ISIGWhen any of the characters INTR, QUIT, SUSP, or DSUSP are received, generate the corresponding signal.
ICANONEnable canonical mode (described below).
ECHOEcho input characters.
ECHOEIf ICANON is also set, the ERASE character erases the preceding input character.
ECHOKIf ICANON is also set, the KILL character erases the current line.
ECHONLIf ICANON is also set, echo the NL character even if ECHO is not set.
NOFLSHDisable flushing the input and output queues when generating signals for the INT, QUIT, and SUSP characters.
TOSTOPSend the SIGTTOU signal to the process group of a background process which tries to write to its controlling terminal.
There are also some non-boolean properties of a #<termios>
type. First up are a set of control characters that may operate on the
terminal.
Given term of type #<termios>, these procedures get and
set the number of bits in the character size: either 5, 6, 7, or
8.
Given term of type #<termios>, these procedures get and
set the end-of-file character. The default end-of-file character is
#\eot.
This character causes the pending tty buffer to be sent to the waiting user program without waiting for end-of-line. If it is the first character of the line, the a read of the associated port will return and end-of-file. This character is recognized when the ICANON property is set.
Given term of type #<termios>, these procedures get and
set an additional end-of-line character. The default extra end-of-line
character is #\nul. This is recognized when the ICANON property
is set.
Given term of type #<termios>, these procedures get and
set the erase character. It may be #\del or #\bs.
When this character is received, it erases the previous not-yet-erased character, but does not erase past EOF or beginning-of-line. Recognized when ICANON is set, and then not passed as input.
Given term of type #<termios>, these procedures get and
set the interrupt character. This is usually #\etx aka
control-C.
When this character is received, it sends a SIGINT signal. Recognized when ISIG is set, and then not passed as input.
Given term of type #<termios>, these procedures get and
set the kill character. This is often #\nak.
When this character is received, this erases the input since the last EOF or beginning-of-line. Recognized when ICANON is set, and then not passed as input.
Given term of type #<termios>, these procedures get and
set the quit character. This is often #\fs aka control-\.
When this character is received, this sends SIGQUIT signal. Recognized when ISIG is set, and then not passed as input.
Given term of type #<termios>, these procedures get and
set the start character. This is usually #\dc1 aka control-Q.
When this character is received, it restarts output stopped by the Stop character. Recognized when IXON is set, and then not passed as input.
Given term of type #<termios>, these procedures get and
set the stop character. This is usually #\dc3 aka control-S.
When this character is received, it stops output until the Start character is typed. Recognized when IXON is set, and then not passed as input.
Given term of type #<termios>, these procedures get and
set the suspend character. This is usually #\sub aka control-Z.
When this character is received, the SIGTSTP signal is sent, and then is not passed as input.
There are input and output speed properties
These functions get and set the input and output speed of the line in bits-per-second. The bps value is an integer, and it should be one of the standard line speeds.
The standard line speeds are 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400. On some systems, they may also be 7200, 14400, 28800, 115200, 230400. If an input bps parameter doesn’t match an available line speed, it will be rounded down to the next available line speed.
There are also two numeric properties having to do with non-canonical reads.
Given term of type #<termios>, these procedures get and
set the time, in seconds, of a non-canonical read. delay is
rounded to the nearest tenth of a second.
Given term of type #<termios>, these procedures get and
set the minimum number of characters that need to be received for a
non-canonical read.
Next: Termios port interface, Previous: Termios introduction, Up: The termios and miscellaneous library [Contents][Index]