summaryrefslogtreecommitdiffstats
path: root/gatchat/test-server.c
diff options
context:
space:
mode:
authorZhenhua Zhang <zhenhua.zhang@intel.com>2010-07-06 14:23:06 +0800
committerMarcel Holtmann <marcel@holtmann.org>2010-07-06 09:49:48 -0300
commit4ec07e9443866d49fe1976d203540ff3ed07fe2f (patch)
tree2ec756bb8433d98cfa40502792485e8ccd89523e /gatchat/test-server.c
parentb86b2d3299bf3c99d87cd852099e7ec18a1cfb7b (diff)
downloadofono-4ec07e9443866d49fe1976d203540ff3ed07fe2f.tar.bz2
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.
Diffstat (limited to 'gatchat/test-server.c')
-rw-r--r--gatchat/test-server.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/gatchat/test-server.c b/gatchat/test-server.c
index 25a1192c..2911978f 100644
--- a/gatchat/test-server.c
+++ b/gatchat/test-server.c
@@ -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);
}