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

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Linux-usb-users@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-users

Reply via email to