On Sun, 19 Mar 2006, Guennadi Liakhovetski wrote:

> Booted 2.6.15.6 on a powerpc embedded board with "console=ttyUSB0,38400" 
> and got the following Oops:
> 
> usbcore: registered new driver usbserial_generic
> drivers/usb/serial/usb-serial.c: USB Serial Driver core
> drivers/usb/serial/usb-serial.c: USB Serial support registered for FTDI USB 
> Serial Device
> ftdi_sio 2-1:1.0: FTDI USB Serial Device converter detected
> drivers/usb/serial/ftdi_sio.c: Detected FT232BM
> usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0
> Oops: kernel access of bad area, sig: 11 [#1]
> PREEMPT
> NIP: C017BF0C LR: C029A0A0 SP: C7C0FCF0 REGS: c7c0fc40 TRAP: 0300    Not 
> tainted
> MSR: 00009032 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11
> DAR: 000000C4, DSISR: 20000000
> TASK = c7c08b10[1] 'swapper' THREAD: c7c0e000
> Last syscall: 120
> GPR00: 00000000 C7C0FCF0 C7C08B10 C022976C C022A0D0 C020F2C0 00000040 00000000
> GPR08: 00002000 C7C21F20 0005DC00 00000000 84042428 1001E920 C7E798B4 C02A0000
> GPR16: 00000001 00000000 00000001 00000000 00000001 C01781B8 C025C0AC C0230000
> GPR24: C017822C C7E79818 00000008 C025C1D0 C7C21F20 C7E78C00 C7D493C0 C7E79600
> NIP [c017bf0c] ftdi_open+0x58/0x1a8
> LR [c029a0a0] usb_console_setup+0x2c4/0x36c
> Call trace:
>  [c029a0a0] usb_console_setup+0x2c4/0x36c
>  [c0016de4] register_console+0x234/0x288
>  [c017a964] usb_serial_console_init+0x40/0x64
>  [c0179218] usb_serial_probe+0xf24/0x110c
>  [c015b0c4] usb_probe_interface+0x78/0xb4
>  [c0133e7c] driver_probe_device+0x50/0xf4
>  [c0134058] __driver_attach+0x84/0x98
>  [c0133334] bus_for_each_dev+0x54/0x98
>  [c0134090] driver_attach+0x24/0x34
>  [c01338ac] bus_add_driver+0x88/0x158
>  [c01345f0] driver_register+0x48/0x5c
>  [c015b2a0] usb_register+0x68/0xcc
>  [c029a1a8] ftdi_init+0x60/0x12c
>  [c0003968] init+0x90/0x294
>  [c0006a54] kernel_thread+0x44/0x60
> Kernel panic - not syncing: Attempted to kill init!

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.

Thanks
Guennadi
---
Guennadi Liakhovetski

diff -u a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
--- a/drivers/usb/serial/ftdi_sio.c     30 Mar 2006 19:18:07 -0000
+++ b/drivers/usb/serial/ftdi_sio.c     6 Apr 2006 21:16:19 -0000
@@ -1264,8 +1264,8 @@
 
        dbg("%s", __FUNCTION__);
 
-
-       port->tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
+       if (port->tty)
+               port->tty->low_latency = (priv->flags & ASYNC_LOW_LATENCY) ? 1 
: 0;
 
        /* No error checking for this (will get errors later anyway) */
        /* See ftdi_sio.h for description of what is reset */
@@ -1279,7 +1279,8 @@
           This is same behaviour as serial.c/rs_open() - Kuba */
 
        /* ftdi_set_termios  will send usb control messages */
-       ftdi_set_termios(port, &tmp_termios);
+       if (port->tty)
+               ftdi_set_termios(port, &tmp_termios);
 
        /* FIXME: Flow control might be enabled, so it should be checked -
           we have no control of defaults! */
@@ -1860,7 +1861,7 @@
                        err("%s urb failed to set baudrate", __FUNCTION__);
                }
                /* Ensure RTS and DTR are raised when baudrate changed from 0 */
-               if ((old_termios->c_cflag & CBAUD) == B0) {
+               if (!old_termios || (old_termios->c_cflag & CBAUD) == B0) {
                        set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
                }
        }


-------------------------------------------------------
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