Q: serial port transmit pending count

Grant Edwards grante at visi.com
Mon Dec 2 10:19:15 EST 2002


In article <3de6d5c5$1 at news.nz.asiaonline.net>, Colin Brown wrote:

> ...
>> 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.

Sorry.

TIOCM_zero_str = struct.pack('I',0)

-- 
Grant Edwards                   grante             Yow!  Now I am depressed...
                                  at               
                               visi.com            



More information about the Python-list mailing list