summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Raasch <ryan.raasch@gmail.com>2009-10-21 10:43:36 +0200
committerMarcel Holtmann <marcel@holtmann.org>2009-10-22 10:17:25 +0900
commita5925f9f290c89f1c4070e0dc65e30104d7e7652 (patch)
tree4a86b9a7ca750cf0d28c57da8fc3a430447e6810
parent7dcd1507b72aba6b88527f6895ea86c94539ab16 (diff)
downloadconnman-a5925f9f290c89f1c4070e0dc65e30104d7e7652.tar.gz
connman-a5925f9f290c89f1c4070e0dc65e30104d7e7652.tar.bz2
connman-a5925f9f290c89f1c4070e0dc65e30104d7e7652.zip
Enable / Disable CREAD functionality in gattty
-rw-r--r--gatchat/gattty.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gatchat/gattty.c b/gatchat/gattty.c
index e1dfe241..30d94446 100644
--- a/gatchat/gattty.c
+++ b/gatchat/gattty.c
@@ -89,6 +89,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"))
@@ -202,6 +214,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;