4 * Copyright (c) 2008 James McKenzie <james@fishsoup.dhs.org>,
9 static char rcsid[] = "$Id$";
13 * Revision 1.11 2008/02/20 18:31:53 james
14 * *** empty log message ***
16 * Revision 1.10 2008/02/15 23:52:12 james
17 * *** empty log message ***
19 * Revision 1.9 2008/02/15 03:32:07 james
20 * *** empty log message ***
22 * Revision 1.8 2008/02/14 10:36:18 james
23 * *** empty log message ***
25 * Revision 1.7 2008/02/14 10:34:30 james
26 * *** empty log message ***
28 * Revision 1.6 2008/02/13 16:59:34 james
29 * *** empty log message ***
31 * Revision 1.5 2008/02/13 16:57:29 james
32 * *** empty log message ***
34 * Revision 1.4 2008/02/12 22:36:46 james
35 * *** empty log message ***
37 * Revision 1.3 2008/02/09 15:47:28 james
38 * *** empty log message ***
46 speed_t_to_baud (speed_t s)
132 baud_to_speed_t (int baud)
217 tty_pre_select (TTY * t, fd_set * rfds, fd_set * wfds)
220 struct timeval now, dif;
225 gettimeofday (&now, NULL);
226 timersub (&now, &t->hangup_clock, &dif);
230 fprintf (stderr, "+DTR\n");
234 ioctl (t->rfd, TIOCMBIS, &line);
240 FD_SET (t->rfd, rfds);
244 tty_get_status (TTY * t, TTY_Status * s)
248 ioctl (t->rfd, TIOCMGET, &s->lines);
252 fprintf (stderr, "s->lines & TIOCM_DTR=%x\n", s->lines & TIOCM_DTR);
255 if (tcgetattr (t->rfd, &s->termios))
258 s->baud = speed_t_to_baud (cfgetispeed (&s->termios));
259 s->blocked = t->blocked;
265 tty_set_baud (TTY * t, int rate)
267 struct termios tios = { 0 };
269 speed_t s = baud_to_speed_t (rate);
271 if (s == (speed_t) - 1)
274 if (tcgetattr (t->rfd, &tios))
277 cfsetispeed (&tios, s);
278 cfsetospeed (&tios, s);
280 tcsetattr (t->rfd, TCSANOW, &tios);
284 tty_send_break (TTY * t)
286 tcsendbreak (t->wfd, 0);
290 tty_set_flow (TTY * t, int flow)
292 struct termios tios = { 0 };
294 if (tcgetattr (t->rfd, &tios))
298 tios.c_cflag |= CRTSCTS;
300 tios.c_cflag &= ~CRTSCTS;
302 tcsetattr (t->rfd, TCSANOW, &tios);
312 ioctl (t->rfd, TIOCMBIC, &line);
315 gettimeofday (&t->hangup_clock, NULL);
317 fprintf (stderr, "-DTR\n");
325 tty_post_select (Context * c, fd_set * rfds, fd_set * wfds)
328 if (FD_ISSET (c->t->rfd, rfds))
330 if (vt102_dispatch (&c))