Commit 70a42193 authored by Wolfgang Fritz's avatar Wolfgang Fritz Committed by Greg Kroah-Hartman

[PATCH] pl2303.c: do not reset termios settings in each open()

USB pl2303 driver

This is a patch which avoids resetting the termios settings to default
values (9600 Baud etc.) in each call to pl2303_open (). It does this
only on the first call to pl2303_set_termios. After that it sets the
termios to the last stored values.

 This way commands like
 stty -F /dev/ttyUSB0 115200
 work the same way as with other serial ttys.
parent 92a234c2
......@@ -142,6 +142,7 @@ static struct usb_serial_device_type pl2303_device = {
struct pl2303_private {
u8 line_control;
u8 termios_initialized;
};
......@@ -214,13 +215,19 @@ static void pl2303_set_termios (struct usb_serial_port *port, struct termios *ol
int baud;
int i;
dbg (__FUNCTION__ " - port %d", port->number);
dbg (__FUNCTION__ " - port %d, initialized = %d", port->number,
((struct pl2303_private *) port->private)->termios_initialized);
if ((!port->tty) || (!port->tty->termios)) {
dbg(__FUNCTION__" - no tty structures");
return;
}
if (!(((struct pl2303_private *) port->private)->termios_initialized)) {
*(port->tty->termios) = tty_std_termios;
port->tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
((struct pl2303_private *) port->private)->termios_initialized = 1;
}
cflag = port->tty->termios->c_cflag;
/* check that they really want us to change something */
if (old_termios) {
......@@ -390,9 +397,6 @@ static int pl2303_open (struct usb_serial_port *port, struct file *filp)
/* Setup termios */
if (port->tty) {
*(port->tty->termios) = tty_std_termios;
port->tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
pl2303_set_termios (port, &tmp_termios);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment