Re: [SOLVED] Serial buffer corruption [was Re: FTDI usb-serial possible bug]



On 5/5/07, Antonino Ingargiola <tritemio@xxxxxxxxx> wrote:
On 5/4/07, Paul Fulghum <paulkf@xxxxxxxxxxxxx> 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.

Ok test done.

With kernel 1. the behavior is the same as with your plain second
patch only (flush input works but I cannot read anymore from the
serial that was flushed without closing and reopening the port). See
previous mail for the details of the test.

With kernel 2 the behavior is the same as mainline (multiple flushes
are needed to completely empty the buffers). And I _can_ read further
chars from the serial line after the flush. Here it is the ipython
session that document the test with kernel 2:

In [1]: import serial

In [2]: s0 = serial.Serial(0, timeout=1)

In [3]: s1 = serial.Serial(1, timeout=1)

In [4]: s0.write('test\n')

In [5]: s1.inWaiting()
Out[5]: 5L

In [6]: s1.readline()
Out[6]: 'test\n'

In [7]: for i in xrange(1000):
...: s0.write(str(i).zfill(8)+'\n')
...:

In [8]: s1.inWaiting()
Out[8]: 4095L

In [9]: s1.flushInput()

In [10]: s1.inWaiting()
Out[10]: 4095L # NOTE the buffer is still full!

In [11]: s1.flushInput()

In [12]: s1.inWaiting()
Out[12]: 810L # The buffer beginning
to be drained

In [13]: s1.flushInput()

In [14]: s1.inWaiting()
Out[14]: 0L # Now the buffer is empty

In [15]: s0.write('test\n') # An reading further chars works

In [16]: s1.inWaiting()
Out[16]: 5L

In [17]: s1.readline()
Out[17]: 'test\n'


Regards,

~ Antonio
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: RT patch acceptance
    ... judge the complexity of a design for that type of system. ... claim that you cannot judge the complexity of a kernel modification. ... Since the patch in question doesn't actually need that information to ... nanokernel's API up to date with additions to Linux's API that RT people ...
    (Linux-Kernel)
  • Re: inline asm semantics: output constraint width smaller than input
    ... Now in this case the patch you suggest might end up hurting the end result ... The below patch is to build the kernel for x86_64, ... # Device Drivers ... # PCI IDE chipsets support ...
    (Linux-Kernel)
  • [RFC] Making percpu module variables have their own memory.
    ... Someone using the -rt patch found that one of the tracing options caused ... 64K for every CPU to cover all the per_cpu variables used in the kernel ... static void wakeup_softirqd_prio ...
    (Linux-Kernel)
  • Re: This is [Re:] How to improve the quality of the kernel[?].
    ... The -mm kernel already implements what your proposed PTS would do. ... If patch have no TS ID, ... Thus i can apply for example lguest patches and implement and test new ... How many open source projects use Bugzilla and how many use the Debian BTS? ...
    (Linux-Kernel)
  • Re: Documentation - how to apply patches for various trees
    ... >> explanation of the various kernel trees and how to apply their patches. ... +a patch to the kernel or, more specifically, what base kernel a patch for ... +and what new version the patch will change the source tree into. ...
    (Linux-Kernel)