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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/5/07, Antonino Ingargiola <[email protected]> wrote:
On 5/4/07, Paul Fulghum <[email protected]> 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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux