]> err.no Git - linux-2.6/blobdiff - drivers/usb/serial/keyspan.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-2.6] / drivers / usb / serial / keyspan.c
index f2a6fce5de1e9fe688b32004364e8589a1f0e8e3..1f7ab15df36dead8dc571ecfc7495560fcdf2259 100644 (file)
@@ -278,29 +278,35 @@ static void keyspan_set_termios (struct usb_serial_port *port,
        struct keyspan_port_private     *p_priv;
        const struct keyspan_device_details     *d_details;
        unsigned int                    cflag;
+       struct tty_struct               *tty = port->tty;
 
        dbg("%s", __FUNCTION__); 
 
        p_priv = usb_get_serial_port_data(port);
        d_details = p_priv->device_details;
-       cflag = port->tty->termios->c_cflag;
+       cflag = 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);
+       baud_rate = tty_get_baud_rate(tty);
        /* If no match or invalid, don't change */              
-       if (baud_rate >= 0
-           && d_details->calculate_baud_rate(baud_rate, d_details->baudclk,
+       if (d_details->calculate_baud_rate(baud_rate, d_details->baudclk,
                                NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) {
                /* FIXME - more to do here to ensure rate changes cleanly */
+               /* FIXME - calcuate exact rate from divisor ? */
                p_priv->baud = baud_rate;
-       }
+       } else
+               baud_rate = tty_termios_baud_rate(old_termios);
 
+       tty_encode_baud_rate(tty, baud_rate, baud_rate);
        /* set CTS/RTS handshake etc. */
        p_priv->cflag = cflag;
        p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none;
 
+       /* Mark/Space not supported */
+       tty->termios->c_cflag &= ~CMSPAR;
+
        keyspan_send_setup(port, 0);
 }
 
@@ -1209,20 +1215,18 @@ 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);
        d_details = p_priv->device_details;
-       
-       dbg("%s - port%d.", __FUNCTION__, port->number); 
+
+       dbg("%s - port%d.", __FUNCTION__, port->number);
 
        /* Set some sane defaults */
        p_priv->rts_state = 1;
@@ -1243,7 +1247,7 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
                urb->dev = serial->dev;
 
                /* make sure endpoint data toggle is synchronized with the device */
-               
+
                usb_clear_halt(urb->dev, urb->pipe);
 
                if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) {
@@ -1259,30 +1263,6 @@ 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);
 }