On Tue, 18 Apr 2006, Paul Fulghum wrote:
> I think setting tty to NULL is just a reflection
> of the code assuming that the console open happens
> only at system startup, before the usb serial port
> is opened for other reasons.
>
> usb_console_setup() should be changed to use the
> current tty value if non-NULL, instead of a dummy tty.
Do you mean something like the patch below? If yes, then it doesn't
help:-( Any idea why?.. I'll try to have a better look too...
Thanks
Guennadi
---
Guennadi Liakhovetski
--- drivers/usb/serial/console.c~ 2006-04-14 10:21:57.000000000 +0200
+++ drivers/usb/serial/console.c 2006-04-21 22:16:24.000000000 +0200
@@ -66,8 +66,8 @@ static int usb_console_setup(struct cons
struct usb_serial *serial;
struct usb_serial_port *port;
int retval = 0;
- struct tty_struct *tty;
- struct termios *termios;
+ struct tty_struct *tty = NULL;
+ struct termios *termios = NULL;
dbg ("%s", __FUNCTION__);
@@ -144,7 +144,7 @@ static int usb_console_setup(struct cons
}
port = serial->port[0];
- port->tty = NULL;
+// port->tty = NULL;
info->port = port;
@@ -166,30 +166,36 @@ static int usb_console_setup(struct cons
}
if (serial->type->set_termios) {
- /* build up a fake tty structure so that the open call has
something
- * to look at to get the cflag value */
- tty = kmalloc (sizeof (*tty), GFP_KERNEL);
- if (!tty) {
- err ("no more memory");
- return -ENOMEM;
- }
- termios = kmalloc (sizeof (*termios), GFP_KERNEL);
- if (!termios) {
- err ("no more memory");
- kfree (tty);
- return -ENOMEM;
+ int temp_tty = 0;
+ if (!port->tty) {
+ /* build up a fake tty structure so that the open call
has something
+ * to look at to get the cflag value */
+ tty = kzalloc (sizeof (*tty), GFP_KERNEL);
+ if (!tty) {
+ err ("no more memory");
+ return -ENOMEM;
+ }
+ termios = kzalloc (sizeof (*termios), GFP_KERNEL);
+ if (!termios) {
+ err ("no more memory");
+ kfree (tty);
+ return -ENOMEM;
+ }
+ temp_tty = 1;
+// memset (tty, 0x00, sizeof(*tty));
+// memset (termios, 0x00, sizeof(*termios));
+ tty->termios = termios;
+ port->tty = tty;
}
- memset (tty, 0x00, sizeof(*tty));
- memset (termios, 0x00, sizeof(*termios));
- termios->c_cflag = cflag;
- tty->termios = termios;
- port->tty = tty;
+ port->tty->termios->c_cflag = cflag;
/* set up the initial termios settings */
serial->type->set_termios(port, NULL);
- port->tty = NULL;
- kfree (termios);
- kfree (tty);
+ if (temp_tty) {
+ port->tty = NULL;
+ kfree (termios);
+ kfree (tty);
+ }
}
return retval;
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel