From 8ad5849da7961354378ebfded4df58aa07013247 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 5 Nov 2008 13:09:32 +0200 Subject: [PATCH] obexd: Use cfmakeraw() to setup the tty termios settings. Without this patch the gadget serial drivers produce easily HUP's and ERR's on the opened tty file descriptor. --- obexd/src/main.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/obexd/src/main.c b/obexd/src/main.c index 455065fbf..24a002cae 100644 --- a/obexd/src/main.c +++ b/obexd/src/main.c @@ -65,21 +65,17 @@ static void tty_init(int service, const gchar *root_path, struct server *server; struct termios options; gint fd; + glong flags; fd = open(devnode, O_RDWR); if (fd < 0) return; - fcntl(fd, F_SETFL, 0); + flags = fcntl(fd, F_GETFL); + fcntl(fd, F_SETFL, flags & ~O_NONBLOCK); tcgetattr(fd, &options); - - options.c_cflag |= (CLOCAL | CREAD); - options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); - options.c_oflag &= ~OPOST; - options.c_cc[VMIN] = 0; - options.c_cc[VTIME] = 10; - + cfmakeraw(&options); tcsetattr(fd, TCSANOW, &options); server = g_malloc0(sizeof(struct server)); -- 2.47.3