From: peter.sheeren@axiris.be
To: linux-serial@vger.kernel.org
Cc: peter.sheeren@axiris.be
Subject: Fwd: Bug in USB FTDI SIO driver
Date: Sat, 08 Sep 2012 12:14:39 +0200 [thread overview]
Message-ID: <20120908121439.15264wgwo05hva8f@webmail.axiris.be> (raw)
[-- Attachment #1: Type: text/plain, Size: 138 bytes --]
Hello
At the suggestion of Greg's friendly e-mail bot I'm sending my report
to this e-mail address. I hope it's the right one.
Peter
[-- Attachment #2: Forwarded Message: Bug in USB FTDI SIO driver --]
[-- Type: message/rfc822, Size: 2759 bytes --]
From: peter.sheeren@axiris.be
To: jhovold@gmail.com, greg@kroah.com
Subject: Bug in USB FTDI SIO driver
Date: Sat, 08 Sep 2012 04:21:06 +0200
Message-ID: <20120908042106.60247e3thepx3q1e@webmail.axiris.be>
Hello
I didn't find an easy way to file a bug report so I extracted the
source file ftdi_sio.c from the latest Linux kernel and browsed for
the e-mail addresses hence this e-mail.
I've been struggling with an annoying plug-and-play issue involving an
FT232RL-based USB device on ARM machines with Linux lately (including
Raspberry Pi and BeagleBoard). In a nutshell the following is happening:
* I plug in the FT232RL-based USB device. /dev/ttyUSB0 is created.
* I run an application that communicate with the device via
/dev/ttyUSB0. The application sets a baudrate - this is important. The
application reads and writes data successfully.
* I unplug the USB device. /dev/ttyUSB0 remains in existence - this is
important too.
* I replug the USB device. /dev/ttyUSB0 is still there.
* I rerun the application. The application again connects with
/dev/ttyUSB0 but it fails to transfer data. So it seems.
I ran I number of tests with a small program on my ARM based systems
and I discovered that the culprit is setting the baudrate. It turns
out that, after replugging the USB device, setting the baudrate is not
relayed to the USB device.
Since this looks like a caching problem, I tracked down the
corresponding source code in ftdi_sio.c and I'm confident the
following text is the cause of the problem:
(line 1375)
if (((old_priv.flags & ASYNC_SPD_MASK) !=
(priv->flags & ASYNC_SPD_MASK)) ||
(((priv->flags & ASYNC_SPD_MASK) == ASYNC_SPD_CUST) &&
(old_priv.custom_divisor != priv->custom_divisor))) {
change_speed(tty, port);
Function change_speed() is called only when the baudrate
(custom_divisor) has changed but after a USB replug this assumption is
wrong. Also note that /dev/ttyUSB0 remains in existence on the system
under test. If it were up to me, I'd always send the baudrate setting
over the USB bus nomatter whether the baudrate (supposedly) has
changed or not.
I found a workaround for this bug: my software sets a different
baudrate prior to the intended baudrate hence fooling the ftdi_sio.c
code but ofcourse it's a workaround.
I hope this report will help you improve your driver.
Best regards,
Peter S'heeren
http://www.axiris.be/
next reply other threads:[~2012-09-08 10:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-08 10:14 peter.sheeren [this message]
2012-09-08 15:45 ` Fwd: Bug in USB FTDI SIO driver Greg KH
2012-09-08 17:16 ` Alan Cox
2012-09-08 17:20 ` peter.sheeren
2012-09-08 17:30 ` Alan Cox
2012-09-08 17:35 ` peter.sheeren
2012-09-08 17:54 ` Alan Cox
2012-09-08 18:19 ` Greg KH
2012-09-08 22:09 ` peter.sheeren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120908121439.15264wgwo05hva8f@webmail.axiris.be \
--to=peter.sheeren@axiris.be \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).