Hi,
I've some trouble with the USB serial driver (ftdi_sio.c for a FT232RL from FTDI). If the
port is opened for the first time, the driver works perfectly. If the port is closed and
open again, it isn't possible to read any data from port. Writing data to the port works.
The FT232RL must be reconnect to get it working again. A reboot without reconnect doesn't
solve this problem. If I look at the debug output, I don't see read requests from
ftdi_sio.c. If reading is possible, I see this read messages:
...
Sep 12 13:36:21 vdr kernel: [ 147.338926]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: Status only: 001o 000o
Sep 12 13:36:21 vdr kernel: [ 147.339921]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: ftdi_read_bulk_callback - port 0
Sep 12 13:36:21 vdr kernel: [ 147.339927]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: ftdi_process_read - port 0
Sep 12 13:36:21 vdr kernel: [ 147.339930]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: Status only: 001o 000o
Sep 12 13:36:21 vdr kernel: [ 147.340931]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: ftdi_read_bulk_callback - port 0
Sep 12 13:36:21 vdr kernel: [ 147.340936]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: ftdi_process_read - port 0
Sep 12 13:36:21 vdr kernel: [ 147.340940]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: Status only: 001o 000o
Sep 12 13:36:21 vdr kernel: [ 147.341927]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: ftdi_read_bulk_callback - port 0
Sep 12 13:36:21 vdr kernel: [ 147.341932]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: ftdi_process_read - port 0
Sep 12 13:36:21 vdr kernel: [ 147.341936]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: Status only: 001o 000o
Sep 12 13:36:21 vdr kernel: [ 147.342924]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: ftdi_read_bulk_callback - port 0
Sep 12 13:36:21 vdr kernel: [ 147.342928]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: ftdi_process_read - port 0
Sep 12 13:36:21 vdr kernel: [ 147.342932]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: Status only: 001o 000o
Sep 12 13:36:21 vdr kernel: [ 147.343924]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: ftdi_read_bulk_callback - port 0
Sep 12 13:36:21 vdr kernel: [ 147.343929]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: ftdi_process_read - port 0
Sep 12 13:36:21 vdr kernel: [ 147.343933] ftdi_sio ttyUSB0: ftdi_process_read - length =
7, data = 01 00 aa 40 0a 00 64
Sep 12 13:36:21 vdr kernel: [ 147.344930]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: ftdi_read_bulk_callback - port 0
Sep 12 13:36:21 vdr kernel: [ 147.344936]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: ftdi_process_read - port 0
Sep 12 13:36:21 vdr kernel: [ 147.344940]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: Status only: 001o 000o
Sep 12 13:36:21 vdr kernel: [ 147.345923]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: ftdi_read_bulk_callback - port 0
Sep 12 13:36:21 vdr kernel: [ 147.345928]
/usr/src/linux-2.6.31-rc3/drivers/usb/serial/ftdi_sio.c: ftdi_process_read - port 0
...
This occurs with 2.6.31 and 2.6.31-rc3. I don't see this problem with 2.6.30.5. It exist
one exception: If I reboot from 2.6.31 to 2.6.30.5, I get the same problem. If I reconnect
the FT232RL, the FT232RL works perfectly. I don't see any problems after closing and
reopening.
Regards,
Hartmut
On Sat, Sep 12, 2009 at 02:08:31PM +0200, e9hack wrote:
> Hi,
>
> I've some trouble with the USB serial driver (ftdi_sio.c for a FT232RL from FTDI). If the
> port is opened for the first time, the driver works perfectly. If the port is closed and
> open again, it isn't possible to read any data from port. Writing data to the port works.
> The FT232RL must be reconnect to get it working again. A reboot without reconnect doesn't
> solve this problem. If I look at the debug output, I don't see read requests from
> ftdi_sio.c. If reading is possible, I see this read messages:
{sigh} Yes, this driver is a bit messed up in .31, sorry. We are
working through it and hope to have a fix in one of the upcoming
.31-stable releases.
thanks,
greg k-h
On Mon, Sep 14, 2009 at 09:43:33AM -0700, Greg KH wrote:
> On Sat, Sep 12, 2009 at 02:08:31PM +0200, e9hack wrote:
> > I've some trouble with the USB serial driver (ftdi_sio.c for a FT232RL from FTDI). If the
> > port is opened for the first time, the driver works perfectly. If the port is closed and
> > open again, it isn't possible to read any data from port. Writing data to the port works.
> > The FT232RL must be reconnect to get it working again. A reboot without reconnect doesn't
> > solve this problem.
I have a similar problem with the same chip after upgrading to 2.6.31,
although the first read after reconnecting the device (usually) works.
> {sigh} Yes, this driver is a bit messed up in .31, sorry. We are
> working through it and hope to have a fix in one of the upcoming
> .31-stable releases.
I've spent some time tracking down the problem and I might have some
information that could be useful:
The commit introducing the regression is
335f8514f200e63d689113d29cb7253a5c282967, which changes the way DTR/RTS
are handled on open; they used to be set prior to setting up the read
urb, now they're set after (in dtr_rts()). Depending on when the first
read callback is made, the driver may stop reading from the device.
The problem became more apparent with
557aaa7ffab639d0190b935a041b16ae44606342 which lowered the device
latency timeout to 1ms, but since setting the timeout does not take
effect until the port is closed and re-opened the driver mostly works
the first time after reconnecting the device.
My test setup opens the port and writes some bytes to a FT232RL with
rx and tx connected, and then reads the looped back data. This usually
works the first time after connecting, whereas reads never return any
data after reopening the port.
When it fails, the first read_bulk callback is made before dtr_rts
returns and port.count is incremented. In particular, the read callback
does not process the data as port.count is 0 at the time and the driver
stops reading from the device. Should the callback be made somewhat
later (as with the default 16ms latency timeout), port.count is non-zero
and all is fine.
Disabling dtr_rts() and calling set_mctrl before setting up the read
urb (as it used to be done) fixes the problem and could be used as a
temporary work-around. But I guess the read callback must be made able
to handle a port count of zero?
Let me know if I can help out with implementing or testing any fixes.
Regards,
Johan Hovold