aboutsummaryrefslogtreecommitdiffstats
path: root/src/tty.c
diff options
context:
space:
mode:
authorjames <>2008-02-15 03:32:07 +0000
committerjames <>2008-02-15 03:32:07 +0000
commita4577aded9b2e23b9d0852310ca53dd4f74b81b7 (patch)
treeaa767ef2ca7b7946c9c9d4f065cbb98d3e951faf /src/tty.c
parent5f9589e991466fec6ffe2273c767243da8ee05c1 (diff)
downloadsympathy-a4577aded9b2e23b9d0852310ca53dd4f74b81b7.tar.gz
sympathy-a4577aded9b2e23b9d0852310ca53dd4f74b81b7.tar.bz2
sympathy-a4577aded9b2e23b9d0852310ca53dd4f74b81b7.zip
*** empty log message ***
Diffstat (limited to 'src/tty.c')
-rw-r--r--src/tty.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/tty.c b/src/tty.c
index cd90810..82fd9ed 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$";
/*
* $Log$
+ * Revision 1.9 2008/02/15 03:32:07 james
+ * *** empty log message ***
+ *
* Revision 1.8 2008/02/14 10:36:18 james
* *** empty log message ***
*
@@ -226,6 +229,49 @@ tty_get_status (TTY * t, TTY_Status * s)
return 0;
}
+void
+tty_set_baud (TTY * t, int rate)
+{
+ struct termios tios = { 0 };
+
+ speed_t s = baud_to_speed_t (rate);
+
+ if (s == (speed_t) - 1)
+ return;
+
+ if (tcgetattr (t->rfd, &tios))
+ return;
+
+ cfsetispeed (&tios, s);
+ cfsetospeed (&tios, s);
+
+ tcsetattr (t->rfd, TCSANOW, &tios);
+}
+
+void
+tty_send_break (TTY * t)
+{
+ tcsendbreak (t->wfd, 0);
+}
+
+void
+tty_set_flow (TTY * t, int flow)
+{
+ struct termios tios = { 0 };
+
+ if (tcgetattr (t->rfd, &tios))
+ return;
+
+ if (flow)
+ tios.c_cflag |= CRTSCTS;
+ else
+ tios.c_cflag &= ~CRTSCTS;
+
+ tcsetattr (t->rfd, TCSANOW, &tios);
+
+}
+
+
#if 0
int
tty_post_select (Context * c, fd_set * rfds, fd_set * wfds)