On Thu, 2006-04-06 at 23:48 +0200, Guennadi Liakhovetski wrote:
> The patch below fixes the Oops, and gets some output with 
> "console=ttyUSB0". But it is not perfect - newlines are not accompanied by 
> carriage returns, and funnily, although in dmesg it says:
> 
> usb 4-2: FTDI USB Serial Device converter now attached to ttyUSB0
> 
> after boot running "stty -F /dev/ttyUSB0" produces "no device".
> 
> So, further fixes would be highly appreciated. Although, I don't know if 
> these problems are specific to ftdi_sio, or to all USB-serial dongles - 
> don't have any other to compare.

Try this patch to fix the ENODEV and CR issues.

I think usb/drivers/console.c usb_console_setup should be altered
to provide the dummy tty struct to both the device open and
device set_termios instead of patching individual drivers
to check for tty == NULL. The comments seem to indicate that
was the original intention.

--- linux-2.6.16/drivers/usb/serial/console.c   2006-03-19 23:53:29.000000000 
-0600
+++ b/drivers/usb/serial/console.c      2006-04-07 13:16:49.000000000 -0500
@@ -216,11 +216,23 @@ static void usb_console_write(struct con
                goto exit;
        }
 
-       /* pass on to the driver specific version of this function if it is 
available */
-       if (serial->type->write)
-               retval = serial->type->write(port, buf, count);
-       else
-               retval = usb_serial_generic_write(port, buf, count);
+       while (count) {
+               /* pass on to the driver specific version of this function if 
it is available */
+               if (serial->type->write)
+                       retval = serial->type->write(port, buf, 1);
+               else
+                       retval = usb_serial_generic_write(port, buf, 1);
+               if (*buf == 10) {
+                       /* append CR after LF */
+                       unsigned char cr = 13;
+                       if (serial->type->write)
+                               retval = serial->type->write(port, &cr, 1);
+                       else
+                               retval = usb_serial_generic_write(port, &cr, 1);
+               }
+               buf++;
+               count--;
+       }
 
 exit:
        dbg("%s - return value (if we had one): %d", __FUNCTION__, retval);
--- linux-2.6.16/drivers/usb/serial/usb-serial.c        2006-03-19 
23:53:29.000000000 -0600
+++ b/drivers/usb/serial/usb-serial.c   2006-04-07 13:11:24.000000000 -0500
@@ -217,6 +217,10 @@ static int serial_open (struct tty_struc
                retval = serial->type->open(port, filp);
                if (retval)
                        goto bailout_module_put;
+       } else if (port->tty == NULL) {
+               /* port used as console */
+               tty->driver_data = port;
+               port->tty = tty;
        }
 
        up(&port->sem);





-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to