Permalink
Browse files

Explicitly add CREAD to c_cflag

CREAD flag is disabled after system boot for some tty devices.
For instance, this is a case for /dev/ttyS? managed by 8250_omap linux kernel driver.
The flag must be set if we want to read from the device.

Reference: http://www.delorie.com/gnu/docs/glibc/libc_364.html

"""
Macro: tcflag_t CREAD
    If this bit is set, input can be read from the terminal. Otherwise, input is discarded when it arrives.
"""

Signed-off-by: Matwey V. Kornilov <matwey.kornilov@gmail.com>
  • Loading branch information...
matwey committed Jun 14, 2016
1 parent ffd2151 commit a1b5ee9831f0e5c108c7ef29338705fa70a72b6b
Showing with 1 addition and 0 deletions.
  1. +1 −0 c_src/serial.c
View
@@ -176,6 +176,7 @@ void set_raw_tty_mode(int fd)
ttymodes.c_cflag |= CS8; /* enable eight bit chars */
ttymodes.c_cflag &= ~PARENB; /* disable input parity check */
+ ttymodes.c_cflag |= CREAD; /* enable receiver */
ttymodes.c_oflag &= ~OPOST; /* disable output processing */

0 comments on commit a1b5ee9

Please sign in to comment.