Termios Supported API¶
Header File¶
Source: include/sys/termios.h
#include <sys/termios.h>
Functions¶
-
void cfmakeraw(struct termios *termios_p)¶
sets the terminal to something like the “raw” mode: input is available character by character, echoing is disabled, and all special processing of terminal input and output characters is disabled
- Parameters
termios_p – termios structure
-
speed_t cfgetispeed(const struct termios *p)¶
Extracts the input baud rate from the input structure exactly (without interpretation).
- Parameters
p – input termios structure
- Returns
input baud rate
-
speed_t cfgetospeed(const struct termios *p)¶
Extracts the output baud rate from the input structure exactly (without interpretation).
- Parameters
p – input termios structure
- Returns
output baud rate
-
int cfsetispeed(struct termios *p, speed_t sp)¶
Set input baud rate in the termios structure.
There is no effect in hardware until a subsequent call of tcsetattr().
- Parameters
p – input termios structure
sp – input baud rate
- Returns
0 when successful, -1 otherwise with errno set
-
int cfsetospeed(struct termios *p, speed_t sp)¶
Set output baud rate in the termios structure.
There is no effect in hardware until a subsequent call of tcsetattr().
- Parameters
p – input termios structure
sp – output baud rate
- Returns
0 when successful, -1 otherwise with errno set
-
int cfsetspeed(struct termios *p, speed_t sp)¶
Set output baud rate in the termios structure.
There is no effect in hardware until a subsequent call of tcsetattr().
- Parameters
p – input termios structure
sp – output baud rate
- Returns
0 when successful, -1 otherwise with errno set
-
int tcdrain(int fd)¶
Wait for transmission of output.
- Parameters
fd – file descriptor of the terminal
- Returns
0 when successful, -1 otherwise with errno set
-
int tcflow(int fd, int action)¶
Suspend or restart the transmission or reception of data.
- Parameters
fd – file descriptor of the terminal
action – selects actions to do
- Returns
0 when successful, -1 otherwise with errno set
-
int tcflush(int fd, int select)¶
Flush non-transmitted output data and non-read input data.
- Parameters
fd – file descriptor of the terminal
select – selects what should be flushed
- Returns
0 when successful, -1 otherwise with errno set
-
int tcgetattr(int fd, struct termios *p)¶
Gets the parameters of the terminal.
- Parameters
fd – file descriptor of the terminal
p – output termios structure
- Returns
0 when successful, -1 otherwise with errno set
-
int tcsendbreak(int fd, int duration)¶
Send a break for a specific duration.
- Parameters
fd – file descriptor of the terminal
duration – duration of break
- Returns
0 when successful, -1 otherwise with errno set
Structures¶
-
struct termios¶
Termios structure
Macros¶
-
CBAUD¶
-
CBAUDEX¶
-
BOTHER¶
-
B0¶
-
B50¶
-
B75¶
-
B110¶
-
B134¶
-
B150¶
-
B200¶
-
B300¶
-
B600¶
-
B1200¶
-
B1800¶
-
B2400¶
-
B4800¶
-
B9600¶
-
B19200¶
-
B38400¶
-
B57600¶
CBAUDEX range B57600 - B4000000
-
B115200¶
-
B230400¶
-
B460800¶
-
B500000¶
-
B576000¶
-
B921600¶
-
B1000000¶
-
B1152000¶
-
B1500000¶
-
B2000000¶
-
B2500000¶
-
B3000000¶
-
B3500000¶
-
B4000000¶
-
CSIZE¶
Character size:
-
CS5¶
5 bits.
-
CS6¶
6 bits.
-
CS7¶
7 bits.
-
CS8¶
8 bits.
-
CSTOPB¶
Send two stop bits, else one.
-
CREAD¶
Enable receiver.
-
PARENB¶
Parity enable.
-
PARODD¶
Odd parity, else even.
-
HUPCL¶
Hang up on last close.
-
CLOCAL¶
Ignore modem status lines.
-
ECHO¶
Enable echo.
-
ECHOE¶
Echo erase character as error-correcting backspace.
-
ECHOK¶
Echo KILL.
-
ECHONL¶
Echo NL.
-
ICANON¶
Canonical input (erase and kill processing).
-
IEXTEN¶
Enable extended input character processing.
-
ISIG¶
Enable signals.
-
NOFLSH¶
Disable flush after interrupt or quit.
-
TOSTOP¶
Send SIGTTOU for background output.
-
XCASE¶
Canonical upper/lower presentation (LEGACY).
-
TCSANOW¶
Change attributes immediately.
-
TCSADRAIN¶
Change attributes when output has drained.
-
TCSAFLUSH¶
Change attributes when output has drained; also flush pending input.
-
TCIFLUSH¶
Flush pending input. Flush un-transmitted output.
-
TCIOFLUSH¶
Flush both pending input and un-transmitted output.
-
TCOFLUSH¶
Flush un-transmitted output.
-
TCIOFF¶
Transmit a STOP character, intended to suspend input data.
-
TCION¶
Transmit a START character, intended to restart input data.
-
TCOOFF¶
Suspend output.
-
TCOON¶
Restart output.
-
VEOF¶
EOF character
-
VEOL¶
EOL character
-
VERASE¶
ERASE character
-
VINTR¶
INTR character
-
VKILL¶
KILL character
-
VMIN¶
MIN value
-
VQUIT¶
QUIT character
-
VSTART¶
START character
-
VSTOP¶
STOP character
-
VSUSP¶
SUSP character
-
VTIME¶
TIME value
-
NCCS¶
Size of the array c_cc for control characters
-
BRKINT¶
Signal interrupt on break.
-
ICRNL¶
Map CR to NL on input.
-
IGNBRK¶
Ignore break condition.
-
IGNCR¶
Ignore CR.
-
IGNPAR¶
Ignore characters with parity errors.
-
INLCR¶
Map NL to CR on input.
-
INPCK¶
Enable input parity check.
-
ISTRIP¶
Strip character.
-
IUCLC¶
Map upper-case to lower-case on input (LEGACY).
-
IXANY¶
Enable any character to restart output.
-
IXOFF¶
Enable start/stop input control.
-
IXON¶
Enable start/stop output control.
-
PARMRK¶
Mark parity errors.
-
OPOST¶
Post-process output
-
OLCUC¶
Map lower-case to upper-case on output (LEGACY).
-
ONLCR¶
Map NL to CR-NL on output.
-
OCRNL¶
Map CR to NL on output.
-
ONOCR¶
No CR output at column 0.
-
ONLRET¶
NL performs CR function.
-
OFILL¶
Use fill characters for delay.
-
NLDLY¶
Select newline delays:
-
NL0¶
Newline character type 0.
-
NL1¶
Newline character type 1.
-
CRDLY¶
Select carriage-return delays:
-
CR0¶
Carriage-return delay type 0.
-
CR1¶
Carriage-return delay type 1.
-
CR2¶
Carriage-return delay type 2.
-
CR3¶
Carriage-return delay type 3.
-
TABDLY¶
Select horizontal-tab delays:
-
TAB0¶
Horizontal-tab delay type 0.
-
TAB1¶
Horizontal-tab delay type 1.
-
TAB2¶
Horizontal-tab delay type 2.
-
TAB3¶
Expand tabs to spaces.
-
BSDLY¶
Select backspace delays:
-
BS0¶
Backspace-delay type 0.
-
BS1¶
Backspace-delay type 1.
-
VTDLY¶
Select vertical-tab delays:
-
VT0¶
Vertical-tab delay type 0.
-
VT1¶
Vertical-tab delay type 1.
-
FFDLY¶
Select form-feed delays:
-
FF0¶
Form-feed delay type 0.
-
FF1¶
Form-feed delay type 1.
Type Definitions¶
-
typedef uint8_t cc_t¶
-
typedef uint32_t speed_t¶
-
typedef uint16_t tcflag_t¶
