diff options
author | james <> | 2008-02-15 23:52:12 +0000 |
---|---|---|
committer | james <> | 2008-02-15 23:52:12 +0000 |
commit | 85a601f7fcaaa64d58567779236a4f3568c219ad (patch) | |
tree | 8f759603b660edb1ff7419cd10d4787f3a2fd33b /src/tty.c | |
parent | 15e84568cdefdddc2191d15156ab5e35d57b47be (diff) | |
download | sympathy-85a601f7fcaaa64d58567779236a4f3568c219ad.tar.gz sympathy-85a601f7fcaaa64d58567779236a4f3568c219ad.tar.bz2 sympathy-85a601f7fcaaa64d58567779236a4f3568c219ad.zip |
*** empty log message ***
Diffstat (limited to 'src/tty.c')
-rw-r--r-- | src/tty.c | 38 |
1 files changed, 38 insertions, 0 deletions
@@ -10,6 +10,9 @@ static char rcsid[] = "$Id$"; /* * $Log$ + * Revision 1.10 2008/02/15 23:52:12 james + * *** empty log message *** + * * Revision 1.9 2008/02/15 03:32:07 james * *** empty log message *** * @@ -210,6 +213,25 @@ baud_to_speed_t (int baud) void tty_pre_select (TTY * t, fd_set * rfds, fd_set * wfds) { + int line; + struct timeval now, dif; + + if (t->hanging_up) + { + + gettimeofday (&now, NULL); + timersub (&now, &t->hangup_clock, &dif); + if (dif.tv_sec) + { + fprintf (stderr, "+DTR\n"); + + line = TIOCM_DTR; + ioctl (t->rfd, TIOCMBIS, &line); + t->hanging_up = 0; + } + } + + FD_SET (t->rfd, rfds); } @@ -219,6 +241,8 @@ tty_get_status (TTY * t, TTY_Status * s) s->lines = 0; ioctl (t->rfd, TIOCMGET, &s->lines); + if (t->hanging_up) + fprintf (stderr, "s->lines & TIOCM_DTR=%x\n", s->lines & TIOCM_DTR); if (tcgetattr (t->rfd, &s->termios)) return -1; @@ -271,6 +295,20 @@ tty_set_flow (TTY * t, int flow) } +void +tty_hangup (TTY * t) +{ + int line; + + line = TIOCM_DTR; + ioctl (t->rfd, TIOCMBIC, &line); + + t->hanging_up = 1; + gettimeofday (&t->hangup_clock, NULL); + fprintf (stderr, "-DTR\n"); + +} + #if 0 int |