diff --git a/headers/posix/termios.h b/headers/posix/termios.h index 5d01343d46..88db94675a 100644 --- a/headers/posix/termios.h +++ b/headers/posix/termios.h @@ -223,6 +223,7 @@ extern speed_t cfgetispeed(const struct termios *termios); extern speed_t cfgetospeed(const struct termios *termios); extern int cfsetispeed(struct termios *termios, speed_t speed); extern int cfsetospeed(struct termios *termios, speed_t speed); +extern void cfmakeraw(struct termios *termios); extern int tcgetattr(int fd, struct termios *termios); extern int tcsetattr(int fd, int option, const struct termios *termios); extern int tcsendbreak(int fd, int duration); diff --git a/src/system/libroot/posix/termios.c b/src/system/libroot/posix/termios.c index 77d3e8dd46..0158f86b30 100644 --- a/src/system/libroot/posix/termios.c +++ b/src/system/libroot/posix/termios.c @@ -146,3 +146,15 @@ cfsetospeed(struct termios *termios, speed_t speed) termios->c_cflag |= speed; return 0; } + + +void +cfmakeraw(struct termios *termios) +{ + termios->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR + | ICRNL | IXON); + termios->c_oflag &= ~OPOST; + termios->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); + termios->c_cflag &= ~(CSIZE | PARENB); + termios->c_cflag |= CS8; +}