diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-11-18 10:37:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-11-18 10:37:38 -0500 |
commit | 78db1caa8ae4e549ffc0bbf0f9b52c113e9a4da0 (patch) | |
tree | bdc364ede8c0fba63f0eacdcb7aaf2efcf4f0bca /drivers | |
parent | 978b4053aefd422713f289f2a315ce2acba62018 (diff) | |
parent | d94c7bd4c1361cab58a21d530078c5673863dcc2 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6:
tty: cp210x: Fix carrier handling
tty_port: If we are opened non blocking we still need to raise the carrier
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/tty_port.c | 3 | ||||
-rw-r--r-- | drivers/usb/serial/cp210x.c | 21 |
2 files changed, 24 insertions, 0 deletions
diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c index a4bbb28f10be..2e8552dc5eda 100644 --- a/drivers/char/tty_port.c +++ b/drivers/char/tty_port.c | |||
@@ -221,6 +221,9 @@ int tty_port_block_til_ready(struct tty_port *port, | |||
221 | the port has just hung up or is in another error state */ | 221 | the port has just hung up or is in another error state */ |
222 | if ((filp->f_flags & O_NONBLOCK) || | 222 | if ((filp->f_flags & O_NONBLOCK) || |
223 | (tty->flags & (1 << TTY_IO_ERROR))) { | 223 | (tty->flags & (1 << TTY_IO_ERROR))) { |
224 | /* Indicate we are open */ | ||
225 | if (tty->termios->c_cflag & CBAUD) | ||
226 | tty_port_raise_dtr_rts(port); | ||
224 | port->flags |= ASYNC_NORMAL_ACTIVE; | 227 | port->flags |= ASYNC_NORMAL_ACTIVE; |
225 | return 0; | 228 | return 0; |
226 | } | 229 | } |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 698252a4dc5d..bd254ec97d14 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -50,6 +50,8 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *, | |||
50 | static void cp210x_break_ctl(struct tty_struct *, int); | 50 | static void cp210x_break_ctl(struct tty_struct *, int); |
51 | static int cp210x_startup(struct usb_serial *); | 51 | static int cp210x_startup(struct usb_serial *); |
52 | static void cp210x_disconnect(struct usb_serial *); | 52 | static void cp210x_disconnect(struct usb_serial *); |
53 | static void cp210x_dtr_rts(struct usb_serial_port *p, int on); | ||
54 | static int cp210x_carrier_raised(struct usb_serial_port *p); | ||
53 | 55 | ||
54 | static int debug; | 56 | static int debug; |
55 | 57 | ||
@@ -143,6 +145,8 @@ static struct usb_serial_driver cp210x_device = { | |||
143 | .tiocmset = cp210x_tiocmset, | 145 | .tiocmset = cp210x_tiocmset, |
144 | .attach = cp210x_startup, | 146 | .attach = cp210x_startup, |
145 | .disconnect = cp210x_disconnect, | 147 | .disconnect = cp210x_disconnect, |
148 | .dtr_rts = cp210x_dtr_rts, | ||
149 | .carrier_raised = cp210x_carrier_raised | ||
146 | }; | 150 | }; |
147 | 151 | ||
148 | /* Config request types */ | 152 | /* Config request types */ |
@@ -746,6 +750,14 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *file, | |||
746 | return cp210x_set_config(port, CP210X_SET_MHS, &control, 2); | 750 | return cp210x_set_config(port, CP210X_SET_MHS, &control, 2); |
747 | } | 751 | } |
748 | 752 | ||
753 | static void cp210x_dtr_rts(struct usb_serial_port *p, int on) | ||
754 | { | ||
755 | if (on) | ||
756 | cp210x_tiocmset_port(p, NULL, TIOCM_DTR|TIOCM_RTS, 0); | ||
757 | else | ||
758 | cp210x_tiocmset_port(p, NULL, 0, TIOCM_DTR|TIOCM_RTS); | ||
759 | } | ||
760 | |||
749 | static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) | 761 | static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) |
750 | { | 762 | { |
751 | struct usb_serial_port *port = tty->driver_data; | 763 | struct usb_serial_port *port = tty->driver_data; |
@@ -768,6 +780,15 @@ static int cp210x_tiocmget (struct tty_struct *tty, struct file *file) | |||
768 | return result; | 780 | return result; |
769 | } | 781 | } |
770 | 782 | ||
783 | static int cp210x_carrier_raised(struct usb_serial_port *p) | ||
784 | { | ||
785 | unsigned int control; | ||
786 | cp210x_get_config(p, CP210X_GET_MDMSTS, &control, 1); | ||
787 | if (control & CONTROL_DCD) | ||
788 | return 1; | ||
789 | return 0; | ||
790 | } | ||
791 | |||
771 | static void cp210x_break_ctl (struct tty_struct *tty, int break_state) | 792 | static void cp210x_break_ctl (struct tty_struct *tty, int break_state) |
772 | { | 793 | { |
773 | struct usb_serial_port *port = tty->driver_data; | 794 | struct usb_serial_port *port = tty->driver_data; |