summaryrefslogtreecommitdiffstats
path: root/unit/test-caif.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-01-28 16:48:33 +0100
committerMarcel Holtmann <marcel@holtmann.org>2010-01-28 16:48:33 +0100
commitbcad38ceffe6a5ed6351027c49bfec78dbe836ff (patch)
treece405969277009cf66b3c007a37e7fd17397d4d8 /unit/test-caif.c
parentc25347dc7e2a633843fe25769026d1f5699de848 (diff)
downloadofono-bcad38ceffe6a5ed6351027c49bfec78dbe836ff.tar.bz2
Use non-blocking and raw mode for test with CAIF character devices
Diffstat (limited to 'unit/test-caif.c')
-rw-r--r--unit/test-caif.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/unit/test-caif.c b/unit/test-caif.c
index a460fdae..8159c4e6 100644
--- a/unit/test-caif.c
+++ b/unit/test-caif.c
@@ -28,6 +28,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
+#include <termios.h>
#include <glib.h>
#include <glib/gprintf.h>
@@ -41,14 +42,22 @@ static GMainLoop *mainloop;
static int do_open(void)
{
+ struct termios ti;
int fd;
- fd = open("/dev/chnlat10", O_RDWR);
+ fd = open("/dev/chnlat11", O_RDWR | O_NOCTTY | O_NONBLOCK);
if (fd < 0) {
- g_printerr("Open of chnlat10 failed (%d)\n", errno);
+ g_printerr("Open of chnlat11 failed (%d)\n", errno);
return -EIO;
}
+ /* Switch TTY to raw mode */
+ memset(&ti, 0, sizeof(ti));
+ cfmakeraw(&ti);
+
+ tcflush(fd, TCIOFLUSH);
+ tcsetattr(fd, TCSANOW, &ti);
+
return fd;
}