From: "Antonino Ingargiola" <tritemio@gmail.com>
To: "Paul Fulghum" <paulkf@microgate.com>
Cc: "Alan Cox" <alan@lxorguk.ukuu.org.uk>,
linux-usb-users@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: Re: [SOLVED] Serial buffer corruption [was Re: FTDI usb-serial possible bug]
Date: Sat, 5 May 2007 11:53:39 +0200 [thread overview]
Message-ID: <5486cca80705050253u35731411ma7c09b3a678c2d49@mail.gmail.com> (raw)
In-Reply-To: <1178276265.3417.3.camel@x2>
On 5/4/07, Paul Fulghum <paulkf@microgate.com> wrote:
> Antonino:
>
> Can you try two tests (with my patch applied):
>
> 1. comment out the tty_flush_buffer() call in tty_ldisc_flush() and test
>
> 2. uncomment (reenable) the above call and comment out the
> tty_flush_buffer() call in tty_ioctl() and test
I assume you meant tty_buffer_flush(). I've built kernel 1). In kernel
2), do you mean:
/*if (ld->ioctl)
tty_buffer_flush(tty);*/
tty_ldisc_deref(ld);
right? This is what I'm building... I'll report these new tests soon.
While waiting for kernel building I'll document the testing procedure.
In this way someone else can easily try to reproduce the problem.
1. Hardware.
Two serial ports required. Connect the two port witth a null-modem
cable, or patch, for each port the Tx pin with the Rx of the other
port[0].
2. Software
I assume python is installed. Install also pyserial[1] (in debian
python-serial), if you manually download the package you can put the
"serial" dir in the dir you use to perform the test (no need to
install system-wide). If you can, install also the ipython shell that
has colored output and auto-completition.
3. Test
>From the python shell:
import serial
s0 = serial.Serial(0, timeout=1)
open the /dev/ttyS0 port with default values, hit 's0' [enter] to see
the serial parameters.
s1 = serial.Serial(1, timeout=1)
with the previous comma we open /dev/ttyS1 with the same serial port
settings. To write to one serial port:
s0.write('test\n')
and to read use the .read() or .readline() method:
s1.readline()
The .inWaiting() methods gives the numbers of bytes in the input
buffer. The .flushInput() method flushes the input buffer:
In [6]: s0.write('test\n')
In [7]: s1.inWaiting()
Out[7]: 5L
In [8]: s1.readline()
Out[8]: 'test\n'
In [9]: s1.inWaiting()
Out[9]: 0L
If all works, now fill one serial port with a bunch of data (an
increasing 8-digit number):
for i in xrange(10000):
s0.write(str(i).zfill(8)+'\n')
we can see that the s1 input buffer is full:
s1.inWaiting()
Out[21]: 4095L
then empty the buffer and see what happens:
In [22]: s1.flushInput()
In [23]: s1.inWaiting()
Out[23]: 4095L
the buffer is still full. You have to flush the buffer more then once
to completely flush all the buffer chain (including the flip buffer).
With the patched kernel at this point I get correctly:
In [22]: s1.flushInput()
In [23]: s1.inWaiting()
Out[23]: 0L
but then I can't read any other byte from the serial without closing
and reopening it:
In [24]: s0.write('test\n')
In [25]: s1.inWaiting()
Out[25]: 0L
In [26]: s1.read()
Out[26]: ''
In [27]: s1.close()
In [28]: s1.open()
In [29]: s1.inWaiting()
Out[29]: 0L
In [30]: s0.write('test\n')
In [31]: s1.inWaiting()
Out[31]: 5L
In [32]: s1.readline()
Out[32]: 'test\n'
Hope the explanation is clear If someone else want to try...
Regards,
~ Antonio
next prev parent reply other threads:[~2007-05-05 15:51 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-04 8:38 Antonino Ingargiola
2007-05-04 8:49 ` Oliver Neukum
[not found] ` <5486cca80705040229g53933671m658bd028cadca155@mail.gmail.com>
2007-05-04 9:33 ` Antonino Ingargiola
2007-05-04 13:41 ` Oliver Neukum
2007-05-04 14:45 ` Paul Fulghum
2007-05-04 14:56 ` Paul Fulghum
2007-05-04 14:49 ` Paul Fulghum
2007-05-04 16:04 ` Antonino Ingargiola
2007-05-04 16:56 ` Antonino Ingargiola
2007-05-04 18:02 ` Paul Fulghum
2007-05-04 17:13 ` Antonino Ingargiola
2007-05-04 17:20 ` Paul Fulghum
2007-05-04 17:25 ` Antonino Ingargiola
2007-05-04 17:41 ` Paul Fulghum
2007-05-04 18:46 ` Antonino Ingargiola
2007-05-04 19:06 ` Antonino Ingargiola
2007-05-04 19:49 ` Paul Fulghum
2007-05-04 21:21 ` Antonino Ingargiola
2007-05-04 10:57 ` Paul Fulghum
2007-05-05 9:53 ` Antonino Ingargiola [this message]
2007-05-05 9:56 ` Antonino Ingargiola
2007-05-05 10:19 ` Antonino Ingargiola
2007-05-04 23:30 ` Paul Fulghum
2007-05-05 8:26 ` Paul Fulghum
2007-05-05 15:11 ` Antonino Ingargiola
2007-05-05 16:43 ` Paul Fulghum
2007-05-05 16:08 ` Paul Fulghum
2007-05-05 16:15 ` Paul Fulghum
2007-05-05 16:26 ` Antonino Ingargiola
2007-05-05 16:58 ` Antonino Ingargiola
2007-05-05 17:04 ` Paul Fulghum
2007-05-05 18:08 ` Antonino Ingargiola
2007-05-05 18:35 ` Oliver Neukum
2007-05-06 7:06 ` Antonino Ingargiola
2007-05-09 9:53 ` Antonino Ingargiola
2007-05-09 10:42 ` Gene Heskett
2007-05-09 11:02 ` Gene Heskett
2007-05-09 12:00 ` Gene Heskett
2007-05-05 16:36 ` Alan Cox
2007-05-05 16:54 ` Oliver Neukum
2007-05-05 21:49 ` Alan Cox
2007-05-05 18:07 ` Oliver Neukum
2007-05-05 21:52 ` Alan Cox
2007-05-06 7:29 ` Antonino Ingargiola
2007-05-06 12:28 ` Alan Cox
2007-05-06 16:39 ` Antonino Ingargiola
2007-05-06 16:46 ` Alan Cox
2007-05-06 21:51 ` [Linux-usb-users] " Alan Stern
2007-05-07 8:07 ` Antonino Ingargiola
2007-05-06 14:35 ` Paul Fulghum
2007-05-07 9:11 ` [Linux-usb-users] " Diego Zuccato
2007-05-07 16:34 ` Alan Stern
2007-05-07 16:51 ` Oliver Neukum
2007-05-07 18:25 ` Alan Stern
2007-05-07 17:58 ` Stephen Beaver
2007-05-06 14:49 ` Paul Fulghum
2007-05-05 16:46 ` Oliver Neukum
2007-05-05 16:56 ` Paul Fulghum
2007-05-05 17:09 ` Antonino Ingargiola
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=5486cca80705050253u35731411ma7c09b3a678c2d49@mail.gmail.com \
--to=tritemio@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-users@lists.sourceforge.net \
--cc=paulkf@microgate.com \
/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
all inboxes | Powered by JetHome®