diff options
Diffstat (limited to 'gatchat/gatchat.c')
-rw-r--r-- | gatchat/gatchat.c | 44 |
1 files changed, 1 insertions, 43 deletions
diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c index 8407338b..fa4f262e 100644 --- a/gatchat/gatchat.c +++ b/gatchat/gatchat.c @@ -24,12 +24,11 @@ #endif #include <stdio.h> -#include <fcntl.h> #include <unistd.h> #include <string.h> #include <assert.h> -#include <termios.h> #include <ctype.h> +#include <errno.h> #include <glib.h> @@ -960,47 +959,6 @@ error: return NULL; } -static int open_device(const char *device) -{ - struct termios ti; - int fd; - - fd = open(device, O_RDWR | O_NOCTTY); - if (fd < 0) - return -1; - - tcflush(fd, TCIOFLUSH); - - /* Switch TTY to raw mode */ - memset(&ti, 0, sizeof(ti)); - cfmakeraw(&ti); - - tcsetattr(fd, TCSANOW, &ti); - - return fd; -} - -GAtChat *g_at_chat_new_from_tty(const char *device, GAtSyntax *syntax) -{ - GIOChannel *channel; - int fd; - GAtChat *chat; - - fd = open_device(device); - if (fd < 0) - return NULL; - - channel = g_io_channel_unix_new(fd); - if (!channel) { - close(fd); - return NULL; - } - - chat = g_at_chat_new(channel, syntax); - g_io_channel_unref(channel); - return chat; -} - GAtChat *g_at_chat_ref(GAtChat *chat) { if (chat == NULL) |