# 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.406   -> 1.407  
#	drivers/usb/serial/pl2303.c	1.6     -> 1.7    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/05/03	wolfgang.fritz@gmx.net	1.407
# [PATCH] pl2303.c: do not reset termios settings in each open()
# 
# 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	Fri May  3 14:51:39 2002
+++ b/drivers/usb/serial/pl2303.c	Fri May  3 14:51:39 2002
@@ -140,6 +140,7 @@
 
 struct pl2303_private { 
 	u8 line_control;
+	u8 termios_initialized;
 };
 
 
@@ -217,13 +218,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) {
@@ -400,9 +407,6 @@
 		SOUP (VENDOR_WRITE_REQUEST_TYPE, VENDOR_WRITE_REQUEST, 2, 4);
 
 		/* Setup termios */
-		*(port->tty->termios) = tty_std_termios;
-		port->tty->termios->c_cflag = B9600 | CS8 | CREAD | HUPCL | CLOCAL;
-
 		pl2303_set_termios (port, &tmp_termios);
 
 		//FIXME: need to assert RTS and DTR if CRTSCTS off
