1 diff -u -p linux/include/net/irda/ircomm_tty.d5.h linux/include/net/irda/ircomm_tty.h
2 --- linux/include/net/irda/ircomm_tty.d5.h Tue Jan 13 09:51:52 2004
3 +++ linux/include/net/irda/ircomm_tty.h Tue Jan 13 10:01:11 2004
4 @@ -122,6 +122,9 @@ void ircomm_tty_stop(struct tty_struct *
5 void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self);
7 extern void ircomm_tty_change_speed(struct ircomm_tty_cb *self);
8 +extern int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file);
9 +extern int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file,
10 + unsigned int set, unsigned int clear);
11 extern int ircomm_tty_ioctl(struct tty_struct *tty, struct file *file,
12 unsigned int cmd, unsigned long arg);
13 extern void ircomm_tty_set_termios(struct tty_struct *tty,
14 diff -u -p linux/net/irda/ircomm/ircomm_tty.d5.c linux/net/irda/ircomm/ircomm_tty.c
15 --- linux/net/irda/ircomm/ircomm_tty.d5.c Tue Jan 13 09:55:04 2004
16 +++ linux/net/irda/ircomm/ircomm_tty.c Tue Jan 13 10:02:52 2004
17 @@ -86,7 +86,9 @@ static struct tty_operations ops = {
18 .write_room = ircomm_tty_write_room,
19 .chars_in_buffer = ircomm_tty_chars_in_buffer,
20 .flush_buffer = ircomm_tty_flush_buffer,
21 - .ioctl = ircomm_tty_ioctl,
22 + .ioctl = ircomm_tty_ioctl, /* ircomm_tty_ioctl.c */
23 + .tiocmget = ircomm_tty_tiocmget, /* ircomm_tty_ioctl.c */
24 + .tiocmset = ircomm_tty_tiocmset, /* ircomm_tty_ioctl.c */
25 .throttle = ircomm_tty_throttle,
26 .unthrottle = ircomm_tty_unthrottle,
27 .send_xchar = ircomm_tty_send_xchar,
28 diff -u -p linux/net/irda/ircomm/ircomm_tty_ioctl.d5.c linux/net/irda/ircomm/ircomm_tty_ioctl.c
29 --- linux/net/irda/ircomm/ircomm_tty_ioctl.d5.c Tue Jan 13 09:54:53 2004
30 +++ linux/net/irda/ircomm/ircomm_tty_ioctl.c Wed Jan 14 11:27:56 2004
31 @@ -190,81 +190,62 @@ void ircomm_tty_set_termios(struct tty_s
35 - * Function ircomm_tty_get_modem_info (self, value)
36 + * Function ircomm_tty_tiocmget (tty, file)
41 -static int ircomm_tty_get_modem_info(struct ircomm_tty_cb *self,
42 - unsigned int *value)
43 +int ircomm_tty_tiocmget(struct tty_struct *tty, struct file *file)
45 + struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
48 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
50 + if (tty->flags & (1 << TTY_IO_ERROR))
53 result = ((self->settings.dte & IRCOMM_RTS) ? TIOCM_RTS : 0)
54 | ((self->settings.dte & IRCOMM_DTR) ? TIOCM_DTR : 0)
55 | ((self->settings.dce & IRCOMM_CD) ? TIOCM_CAR : 0)
56 | ((self->settings.dce & IRCOMM_RI) ? TIOCM_RNG : 0)
57 | ((self->settings.dce & IRCOMM_DSR) ? TIOCM_DSR : 0)
58 | ((self->settings.dce & IRCOMM_CTS) ? TIOCM_CTS : 0);
60 - return put_user(result, value);
65 - * Function set_modem_info (driver, cmd, value)
66 + * Function ircomm_tty_tiocmset (tty, file, set, clear)
71 -static int ircomm_tty_set_modem_info(struct ircomm_tty_cb *self,
72 - unsigned int cmd, unsigned int *value)
73 +int ircomm_tty_tiocmset(struct tty_struct *tty, struct file *file,
74 + unsigned int set, unsigned int clear)
77 - __u8 old_rts, old_dtr;
78 + struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data;
80 IRDA_DEBUG(2, "%s()\n", __FUNCTION__ );
82 + if (tty->flags & (1 << TTY_IO_ERROR))
85 ASSERT(self != NULL, return -1;);
86 ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;);
88 - if (get_user(arg, value))
90 + if (set & TIOCM_RTS)
91 + self->settings.dte |= IRCOMM_RTS;
92 + if (set & TIOCM_DTR)
93 + self->settings.dte |= IRCOMM_DTR;
95 + if (clear & TIOCM_RTS)
96 + self->settings.dte &= ~IRCOMM_RTS;
97 + if (clear & TIOCM_DTR)
98 + self->settings.dte &= ~IRCOMM_DTR;
100 - old_rts = self->settings.dte & IRCOMM_RTS;
101 - old_dtr = self->settings.dte & IRCOMM_DTR;
105 - if (arg & TIOCM_RTS)
106 - self->settings.dte |= IRCOMM_RTS;
107 - if (arg & TIOCM_DTR)
108 - self->settings.dte |= IRCOMM_DTR;
112 - if (arg & TIOCM_RTS)
113 - self->settings.dte &= ~IRCOMM_RTS;
114 - if (arg & TIOCM_DTR)
115 - self->settings.dte &= ~IRCOMM_DTR;
119 - self->settings.dte =
120 - ((self->settings.dte & ~(IRCOMM_RTS | IRCOMM_DTR))
121 - | ((arg & TIOCM_RTS) ? IRCOMM_RTS : 0)
122 - | ((arg & TIOCM_DTR) ? IRCOMM_DTR : 0));
129 - if ((self->settings.dte & IRCOMM_RTS) != old_rts)
130 + if ((set|clear) & TIOCM_RTS)
131 self->settings.dte |= IRCOMM_DELTA_RTS;
133 - if ((self->settings.dte & IRCOMM_DTR) != old_dtr)
134 + if ((set|clear) & TIOCM_DTR)
135 self->settings.dte |= IRCOMM_DELTA_DTR;
137 ircomm_param_request(self, IRCOMM_DTE, TRUE);
138 @@ -406,14 +387,6 @@ int ircomm_tty_ioctl(struct tty_struct *
143 - ret = ircomm_tty_get_modem_info(self, (unsigned int *) arg);
148 - ret = ircomm_tty_set_modem_info(self, cmd, (unsigned int *) arg);
151 ret = ircomm_tty_get_serial_info(self, (struct serial_struct *) arg);