Serial programming under Linux: struct Termios structure

Source: Internet
Author: User
Tags echo display lowercase posix range linux

Termios Structural Body Description

In a termios structure, the struct body generally includes the following members:

tcflag_t C_iflag;

tcflag_t C_oflag;

tcflag_t C_cflag;

tcflag_t C_lflag;

cc_t C_cc[nccs];

Its specific meaning is as follows

C_iflag: Input mode flag, control terminal input mode, the specific parameters are shown below.

C_iflag parameter Table

Key value Description

IGNBRK Ignore break key input

Brkint If the Ignbrk,break key is set, the input will be ignored and if Brkint is set, a SIGINT interrupt will be generated

Ignpar ignores parity errors

PARMRK Identity Parity Error

INPCK allows input parity

Istrip removes the 8th bit of the character

INLCR converts the input nl (newline) to CR (carriage return)

IGNCR ignores input carriage returns

ICRNL converts the entered carriage return to a newline (if IGNCR is not set)

IUCLC converts input uppercase characters to lowercase characters (non-POSIX)

Ixon control of Xon/xoff flow when input is allowed

Ixany enter any character to reboot the stopped output

Ixoff control of Xon/xoff flow when input is allowed

Imaxbel starts ringing when the input queue is full, and Linux uses this parameter to assume that the parameter is always set

C_oflag: Output mode flag, control the terminal output mode, the specific parameters are shown below.

C_oflag parameters

Key value Description

Opost after processing output

OLCUC converts input lowercase characters to uppercase characters (non-POSIX)

ONLCR converts the input nl (newline) to CR (carriage return) and NL (linefeed).

OCRNL converts the input CR (carriage return) to NL (line wrap)

ONOCR the first line does not output a return character

Onlret does not output carriage return characters

Ofill send fill characters to delay terminal output

Ofdel is populated with the ASCII key, and if this argument is not set, the padding character will be nul ('/0 ') (non-POSIX)

nldly output delay, can be taken NL0 (without delay) or NL1 (delay 0.1s)

crdly carriage return delay with a value range of: CR0, CR1, CR2 and CR3

tabdly horizontal tab output delay, values range: TAB0, TAB1, TAB2, and TAB3

bsdly space output delay, you can take BS0 or BS1

vtdly vertical tab Output delay, you can take VT0 or VT1

ffdly delay, you can take FF0 or FF1

C_cflag: Control mode flag, specify terminal hardware control information, the specific parameters are shown below.

C_oflag parameters

Key value Description

Cbaud baud rate (4+1 bit) (non-POSIX)

Cbaudex additional baud rate (1-bit) (non-POSIX)

CSize character length, CS5, CS6, CS7, or CS8

CSTOPB set two stop bits

Cread using the receiver

Parenb with Parity

Parodd with parity for input, parity on output

HUPCL suspend when device is closed

Clocal Ignore modem line status

Crtscts using Rts/cts flow control

C_lflag: Local mode flag, control the terminal editing function, the specific parameters are shown below.

C_lflag parameters

Key value Description

Isig when entering Intr, QUIT, Susp, or DSUSP, the corresponding signal is generated

Icanon Use standard input mode

Xcase when Icanon and Xcase are set simultaneously, the terminal uses only uppercase. If only xcase is set, the input character is converted to lowercase characters unless the character uses an escape character (not POSIX and Linux does not support this parameter)

ECHO Display Input characters

Echoe if Icanon is set at the same time, erase will delete the entered characters, Werase will delete the input words

Echok If the Icanon is set at the same time, kill will delete when the forward

Echonl If the Icanon is set at the same time, even if Echo is not set, still show line breaks

Echoprt if Echo and Icanon are set simultaneously, the printed characters will be deleted (non-POSIX)

Tostop sends Sigttou signal to background output

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.