Q: serial port transmit pending count
Colin Brown
cbrown at metservice.com
Thu Nov 28 21:49:40 EST 2002
"Grant Edwards" <grante at visi.com> wrote in message
news:3de415a7$0$22175$a1866201 at newsreader.visi.com...
...
> TIOCOUTQ returns the number of buffered tx chars. For some
> drivers (e.g. 16x50 UARTS) it doesn't appear to include
> characters in the hardware FIFO. For some others, I know it
> does.
>
> import termios,fcntl,struct
>
> def txCount(fd):
> s = fcntl.ioctl(fd,termios.TIOCOUTQ,TIOCM_zero_str)
> return struct.unpack('I',s)[0]
I tried to implement but was unable to figure out what TIOCM_zero_str should
be
from the different options available in ioctl or termios.
>From my pySerial instance (ser) the file descriptor ser.fd (as used in
serialposix.write) in
the above function without the 3rd (optional) argument gave me an
IOError: [Errno 14] Bad address.
Printing ser.fd returned the number 3.
Further assistance would be appreciated.
Colin Brown
More information about the Python-list
mailing list