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



Antonino Ingargiola wrote:
Nope. In python I use the flushInput() method of the serial object
defined by the pyserial library[0]. The method does just this system
call:

termios.tcflush(self.fd, TERMIOS.TCIFLUSH)

that I think is correct.

There is intermediate buffering between the driver and
the line discipline called the tty flip buffer.

receive data flow:
driver --> tty flip --> line discipline --> application

When you flush input, the line disciplines flush_buffer() method
is called to clear any data residing the in the line discipline.

This does not affect the tty flip buffer
or hardware receive FIFOs.

I suspect the biggest problem is the data in the
tty flip buffer.

A new function to flush the tty flip buffer needs to
be added and then called from tty_io.c:tty_ldisc_flush().

Then a call to tcflush(TCIFLUSH) will clear both buffers.

This still would not clear any data in the hardware
receive FIFOs.

--
Paul Fulghum
Microgate Systems, Ltd.
-
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

  • [PATCH] tty_set_ldisc receive_room fix
    ... discipline to change to the same line discipline. ... flip buffer from passing receive data to the line discipline. ... a switch from N_TTY to N_TTY followed by ... the tty flip buffer pushed data to the line discipline ...
    (Linux-Kernel)
  • Re: ref clock for network POP locations
    ... I was referring to sub-microsecond accuracy over the network, it seems that the OP has no chance to use a hardware ref clock. ... PTP uses hardware timestamping at the MII/PHY level, this will not help when you use the Internet, but maybe the OP has his own nice WAN with low-jitter connections available. ... The mentioned LANTIME/NDT is basically an oscillator that is disciplined by NTP. ... I question whether it can maintain "sub microsecond accuracy" without the GPS discipline. ...
    (comp.protocols.time.ntp)
  • Re: serio interface
    ... serial port with the help of `inputattach' to a given device driver, ... which expects to find its hardware on that port. ... This is currently implemented as a line discipline, ... it means that a userspace daemon is needed which does ...
    (Linux-Kernel)
  • Re: IEE or IEEE
    ... >>They do not have a sufficient depth of understanding of hardware. ... which a high level of knowledge outside your own specific discipline is ... Ian Bell ...
    (comp.arch.embedded)