Skip to content

Commit

Permalink
Explicitly add CREAD to c_cflag
Browse files Browse the repository at this point in the history
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 a1b5ee9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions c_src/serial.c
Expand Up @@ -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 */

Expand Down

0 comments on commit a1b5ee9

Please sign in to comment.