Make termios mode raw.
(mode)
| 16 | CC = 6 |
| 17 | |
| 18 | def cfmakeraw(mode): |
| 19 | """Make termios mode raw.""" |
| 20 | # Clear all POSIX.1-2017 input mode flags. |
| 21 | # See chapter 11 "General Terminal Interface" |
| 22 | # of POSIX.1-2017 Base Definitions. |
| 23 | mode[IFLAG] &= ~(IGNBRK | BRKINT | IGNPAR | PARMRK | INPCK | ISTRIP | |
| 24 | INLCR | IGNCR | ICRNL | IXON | IXANY | IXOFF) |
| 25 | |
| 26 | # Do not post-process output. |
| 27 | mode[OFLAG] &= ~OPOST |
| 28 | |
| 29 | # Disable parity generation and detection; clear character size mask; |
| 30 | # let character size be 8 bits. |
| 31 | mode[CFLAG] &= ~(PARENB | CSIZE) |
| 32 | mode[CFLAG] |= CS8 |
| 33 | |
| 34 | # Clear all POSIX.1-2017 local mode flags. |
| 35 | mode[LFLAG] &= ~(ECHO | ECHOE | ECHOK | ECHONL | ICANON | |
| 36 | IEXTEN | ISIG | NOFLSH | TOSTOP) |
| 37 | |
| 38 | # POSIX.1-2017, 11.1.7 Non-Canonical Mode Input Processing, |
| 39 | # Case B: MIN>0, TIME=0 |
| 40 | # A pending read shall block until MIN (here 1) bytes are received, |
| 41 | # or a signal is received. |
| 42 | mode[CC] = list(mode[CC]) |
| 43 | mode[CC][VMIN] = 1 |
| 44 | mode[CC][VTIME] = 0 |
| 45 | |
| 46 | def cfmakecbreak(mode): |
| 47 | """Make termios mode cbreak.""" |