# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.568   -> 1.569  
#	drivers/usb/serial/pl2303.c	1.14    -> 1.15   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/05/02	wolfgang.fritz@gmx.net	1.569
# [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.
# --------------------------------------------
#
diff -Nru a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
--- a/drivers/usb/serial/pl2303.c	Thu May  2 16:47:05 2002
+++ b/drivers/usb/serial/pl2303.c	Thu May  2 16:47:05 2002
@@ -142,6 +142,7 @@
 
 struct pl2303_private { 
 	u8 line_control;
+	u8 termios_initialized;
 };
 
 
@@ -214,13 +215,19 @@
 	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 @@
 
 	/* 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);
 	}
 
