summaryrefslogtreecommitdiffstats
path: root/gatchat/gattty.c
diff options
context:
space:
mode:
authorRyan Raasch <ryan.raasch@gmail.com>2009-10-21 10:43:36 +0200
committerDenis Kenzior <denkenz@gmail.com>2009-10-21 19:06:43 -0500
commitd1db227d20892996c9ced11ca700d4b177541867 (patch)
tree4bfa6ce3fec70d94856512d549dd24de2988c86a /gatchat/gattty.c
parent2b695bcdb6743a76844a0a77b66826f212379370 (diff)
downloadofono-d1db227d20892996c9ced11ca700d4b177541867.tar.bz2
Enable / Disable CREAD functionality in gattty
Diffstat (limited to 'gatchat/gattty.c')
-rw-r--r--gatchat/gattty.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gatchat/gattty.c b/gatchat/gattty.c
index 63d26d43..f18eca4e 100644
--- a/gatchat/gattty.c
+++ b/gatchat/gattty.c
@@ -97,6 +97,18 @@ static gboolean set_baud(const char *baud, struct termios *ti)
return TRUE;
}
+static gboolean set_read(const char *bits, struct termios *ti)
+{
+ if (g_str_equal(bits, "off"))
+ ti->c_cflag &= ~(CREAD);
+ else if (g_str_equal(bits, "on"))
+ ti->c_cflag |= CREAD;
+ else
+ return FALSE;
+
+ return TRUE;
+}
+
static gboolean set_stop_bits(const char *bits, struct termios *ti)
{
if (g_str_equal(bits, "1"))
@@ -210,6 +222,8 @@ static int open_device(const char *tty, GHashTable *options)
ok = set_rtscts(value, &ti);
else if (g_str_equal(key, "local"))
ok = set_local(value, &ti);
+ else if (g_str_equal(key, "read"))
+ ok = set_read(value, &ti);
if (ok == FALSE)
return -1;