test-server: Use cfmakeraw to set TTY raw mode

Use cfmakeraw to disable echoing and special characters processing. If
we don't turn off ICRNL, TTY layer translates \r\n to \n\n.
This commit is contained in:
Zhenhua Zhang 2010-07-06 14:23:06 +08:00 committed by Marcel Holtmann
parent b86b2d3299
commit 4ec07e9443
1 changed files with 3 additions and 5 deletions

View File

@ -848,12 +848,10 @@ static void set_raw_mode(int fd)
{
struct termios options;
memset(&options, 0, sizeof(struct termios));
tcgetattr(fd, &options);
/* Set TTY as raw mode to disable echo back of input characters
* when they are received from Modem to avoid feedback loop */
options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
tcflush(fd, TCIOFLUSH);
cfmakeraw(&options);
tcsetattr(fd, TCSANOW, &options);
}