简体   繁体   中英

Linux serial port programming c_cc character configurations

By referencing the source in the following link : Serial_Port_Programming_How_To

I found out that there are c_cc character configurations there. After searching around the affections, I did not find the exact answer to this. I try to comment out each line of these c_cc configurations and found out the following line does affect the output.

newtio.c_cc[VEOF]     = 4;

Can anyone explain the meaning of this and possibly for the rest of these?

Thanks

As suggested, the manual page for termios is a starting point:

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.

In the context of the given link, 3.1. Canonical Input Processing , the OP has observed that commenting out an assignment

newtio.c_cc[VEOF]     = 4;

prevents ^D from working as expected. That, and similar assignments correspond to the settings one might use for a shell script with stty . Internally (using termios ) those are set to an undefined value when assigned 0xff , but a default 0x00 is almost as good.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM