Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 May 1999 16:09:33 -0400
From:      "Louis A. Mamakos" <louie@TransSys.COM>
To:        Mike Smith <mike@smith.net.au>
Cc:        Max Gotlib <max@cca.usart.ru>, hackers@FreeBSD.ORG
Subject:   Re: Serial ports programming 
Message-ID:  <199905272009.QAA51618@whizzo.transsys.com>
In-Reply-To: Your message of "Thu, 27 May 1999 11:37:56 PDT." <199905271837.LAA01313@dingo.cdrom.com> 
References:  <199905271837.LAA01313@dingo.cdrom.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> > Hi!
> > 
> > Some days ago I've faced with the following problem:
> > I need some kind of action (while coding user space
> > program actively handling the serial port) to get
> > sure all the bytes I've wrote to it are _transmitted_.
> > I know about "ioctl(fd, TIOCDRAIN)", but this ioctl
> > is accomplished with tty buffers draining to (probably)
> > FIFO buffer of the serial port. Is there any (portable
> > preferably) way to get an acknolege or to block until
> > FIFO buffer is cleared? The situation is that I can't
> > simply write additional 64 bytes (I did not see any
> > serial ports with FIFO larger than 64 bytes) and
> > drain the tty buffers - I have to catch the exact
> > moment ...
> 
> You could close the device, but that may have an adverse effect on your 
> application, as it will drop DTR.
> 
> There is no other way, no.

Generally speaking, when you have this type of concern regarding 
communications between two devices, you have to rely on the remote device
to acknowledge the data.  Even if you knew all the bits left the
UART in your serial port, the data could have been damaged along the way,
or might simply be queued up inside of an error-corrected modem that's
trying to deliver the data to the remote end.

louie




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199905272009.QAA51618>