From owner-freebsd-hackers Thu May 27 13:12: 9 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from whizzo.transsys.com (whizzo.TransSys.COM [144.202.42.10]) by hub.freebsd.org (Postfix) with ESMTP id 9246E159E6 for ; Thu, 27 May 1999 13:12:01 -0700 (PDT) (envelope-from louie@whizzo.transsys.com) Received: from whizzo.transsys.com (localhost.transsys.com [127.0.0.1]) by whizzo.transsys.com (8.9.3/8.9.1) with ESMTP id QAA51618; Thu, 27 May 1999 16:09:33 -0400 (EDT) (envelope-from louie@whizzo.transsys.com) Message-Id: <199905272009.QAA51618@whizzo.transsys.com> X-Mailer: exmh version 2.0.2 2/24/98 To: Mike Smith Cc: Max Gotlib , hackers@FreeBSD.ORG From: "Louis A. Mamakos" Subject: Re: Serial ports programming References: <199905271837.LAA01313@dingo.cdrom.com> In-reply-to: Your message of "Thu, 27 May 1999 11:37:56 PDT." <199905271837.LAA01313@dingo.cdrom.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 27 May 1999 16:09:33 -0400 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > 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