clearing serial port
Grant Edwards
grante at visi.com
Wed Jan 30 12:20:54 EST 2002
In article <3C57E2B9.3000109 at beth.uniforum.org.za>, mixo wrote:
> Grant Edwards wrote:
>
>
>> You need to flush the input buffer in the serial port device
>> driver. Under Unix, it's done with the tcflush() system call
>> or the corresponding ioctl() call.
>
> Here is what I do
> +++++++++++++++++++++++++++++++++++++++++++
> termios.tcflush (self.fd, TCIFLUSH)
> termios.tcsendbreak (self.fd,1)
> buffer = os.read (self.fd,nchars)
> +++++++++++++++++++++++++++++++++++++++++++
>
> The problem I get from this, is that I don't always get
> data if I flush the input buffer. In fact, when I do get data,
> it is usually incomplete.
Just as an experiment, you could try adding delays in various
places (e.g. between the break and the read).
--
Grant Edwards grante Yow! I FORGOT to do the
at DISHES!!
visi.com
More information about the Python-list
mailing list