Linux串口编程c_cc字符配置

Linux serial port programming c_cc character configurations

引用来源如下link: Serial_Port_Programming_How_To

我发现那里有 c_cc 个字符配置。 在搜索了 affections 之后,我没有找到确切的答案。 我尝试注释掉这些 c_cc 配置的每一行,发现以下行确实影响了输出。

newtio.c_cc[VEOF]     = 4;

任何人都可以解释这句话的意思吗?可能还有其他的意思吗?

谢谢

按照建议,termios 的手册页是起点:

VEOF

(004, EOT, Ctrl-D) End-of-file character (EOF). More precisely: 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 read(2) in the user program returns 0, which signifies end-of-file. Recognized when ICANON is set, and then not passed as input.

在给定的 link、3.1. Canonical Input Processing 的上下文中,OP 观察到注释掉一个赋值

newtio.c_cc[VEOF]     = 4;

阻止 ^D 按预期工作。那和类似的分配对应于可能用于带有 stty 的 shell 脚本的设置。在内部(使用 termios)这些在分配 0xff 时设置为 undefined 值,但默认值 0x00 几乎一样好。