Nico Huber has posted comments on this change. ( https://review.coreboot.org/23693 )
Change subject: improve termios settings on some OSes ......................................................................
Patch Set 1:
(1 comment)
I have generally trouble to understand why everybody modifies an existing terminal config instead of writing his own. Are there too many implementation specific pitfalls?
https://review.coreboot.org/#/c/23693/1/serial.c File serial.c:
https://review.coreboot.org/#/c/23693/1/serial.c@216 PS1, Line 216: wanted.c_cflag &= ~(PARENB | CSTOPB | CSIZE | CRTSCTS); : wanted.c_cflag |= (CS8 | CLOCAL | CREAD); : wanted.c_lflag &= ~(ICANON | ECHO | ECHOE | ECHOK | ECHONL | ISIG | IEXTEN); : wanted.c_lflag &= ~(ECHOCTL | ECHOKE); : wanted.c_iflag &= ~(IXON | IXOFF | IXANY | ICRNL | IGNCR | INLCR); : wanted.c_iflag &= ~(PARMRK); : wanted.c_oflag &= ~OPOST;
It might be wise to start with cfmakeraw(3). Although it does not appear to be standardized by Open Group, I see cfmakeraw(3) available on my GNU/Linux installations.
https://nxr.netbsd.org/xref/src/lib/libc/termios/cfmakeraw.c#51
Given that flashrom is supposed to work on much more than Linux/BSD, I'd rather not try to use non-standard functions.
But, if you've covered all the bits that NetBSD's cfmakeraw(3) does, I have no objection.
It's actually your patch ;) I merely ported it from patchwork [1]. No idea if anybody or why nobody considered it earlier.
I have trouble understanding every detail in the man pages and have no way for regression testing (lack of any serial based programmer). That's also why a related commit, 22334, didn't make it into the 1.0 release.
If you can test this on at least two different OSs (e.g. Linux, BSD) that would be very nice.
[1] https://patchwork.coreboot.org/patch/2757/