revert "keyspan: init termios properly"
authorAndrew Morton <akpm@linux-foundation.org>
Thu, 29 Nov 2007 00:21:54 +0000 (16:21 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 29 Nov 2007 17:24:54 +0000 (09:24 -0800)
Revert 7eea436433b7b18045f272562e256976f593f7c0.

Lucy said:

  This patch will work with the 19HS but WILL BREAK all other Keyspan
  adapters.  It will take me a few days to get to looking at a correct fix but
  that keyspan_send_setup(port, 1) (and the '1' is the important part) must
  happen once when the port is first opened.  The cflag can just be set to
  whatever the normal default is for your serial environment.

So revert this again pending the proper fix.

Cc: Borislav Petkov <bbpetkov@yahoo.de>
Cc: Greg KH <greg@kroah.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Lucy McCoy <lucy@keyspan.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/usb/serial/keyspan.c

index 1f7ab15df36dead8dc571ecfc7495560fcdf2259..feba9679ace8b35103fc7ac0315adefdf97b855f 100644 (file)
@@ -1215,12 +1215,14 @@ static int keyspan_chars_in_buffer (struct usb_serial_port *port)
 
 static int keyspan_open (struct usb_serial_port *port, struct file *filp)
 {
-       struct keyspan_port_private     *p_priv;
-       struct keyspan_serial_private   *s_priv;
-       struct usb_serial               *serial = port->serial;
+       struct keyspan_port_private     *p_priv;
+       struct keyspan_serial_private   *s_priv;
+       struct usb_serial               *serial = port->serial;
        const struct keyspan_device_details     *d_details;
        int                             i, err;
+       int                             baud_rate, device_port;
        struct urb                      *urb;
+       unsigned int                    cflag;
 
        s_priv = usb_get_serial_data(serial);
        p_priv = usb_get_serial_port_data(port);
@@ -1263,6 +1265,30 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
                /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */
        }
 
+       /* get the terminal config for the setup message now so we don't
+        * need to send 2 of them */
+
+       cflag = port->tty->termios->c_cflag;
+       device_port = port->number - port->serial->minor;
+
+       /* Baud rate calculation takes baud rate as an integer
+          so other rates can be generated if desired. */
+       baud_rate = tty_get_baud_rate(port->tty);
+       /* If no match or invalid, leave as default */
+       if (baud_rate >= 0
+           && d_details->calculate_baud_rate(baud_rate, d_details->baudclk,
+                               NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) {
+               p_priv->baud = baud_rate;
+       }
+
+       /* set CTS/RTS handshake etc. */
+       p_priv->cflag = cflag;
+       p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none;
+
+       keyspan_send_setup(port, 1);
+       //mdelay(100);
+       //keyspan_set_termios(port, NULL);
+
        return (0);
 }