diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2008-11-05 13:09:32 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2008-11-05 13:09:32 +0200 |
commit | eb2b875f3eeb90bcf56e17e7912267ccbd77d9fd (patch) | |
tree | 462b28694cb2fdf8d71bcc3e65308873e21fc55b | |
parent | 088a10434777d6f6eb87309cfac14d4ffca4b40e (diff) | |
download | obexd-eb2b875f3eeb90bcf56e17e7912267ccbd77d9fd.tar.gz |
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.
-rw-r--r-- | src/main.c | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -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)); |