From: Chuck Messenger <chuckm@rochester.rr.com>
To: linux-serial@vger.kernel.org
Subject: Re: low_latency flag
Date: Fri, 21 Nov 2003 18:37:32 -0500 [thread overview]
Message-ID: <bpm6vr$86c$1@sea.gmane.org> (raw)
In-Reply-To: <20031121224338.GI1037@lug-owl.de>
Jan-Benedict Glaw wrote:
> On Fri, 2003-11-21 16:59:50 -0500, Chuck Messenger <chuckm@rochester.rr.com>
> wrote in message <bpm18m$73f$1@sea.gmane.org>:
>
>>Luckily, I happened to notice a recent message on this list with the
>>word "low_latency". This led me to discover the low_latency flag, which
>>you can set with "setserial /dev/ttyS0 low_latency". This sets a
>>special mode on the port, which defeats some kernel-level buffering. I
>>don't (yet) know how to set this mode programmatically -- I just call
>>system("...") from my code (yech!).
>
>
> Looking at setserial's sources, something like this:
>
> struct serial_struct serinfo;
> fd = open ("/dev/ttySxx");
> ioctl (fd, TIOCGSERIAL, &serinfo);
> serinfo.flags |= 0x4000;
> ioctl (fd, TIOCSSERIAL, &serinfo);
> close (fd);
>
> should do. Of course, not tested and missing all error handling:-(
>
> MfG, JBG
Thanks for the idea. Looking into it, I see in
/usr/include/linux/serial.h, the definition for serial_struct. The
comments show these values for the flags member:
/*
* Definitions for async_struct (and serial_struct) flags field
*/
...
#define ASYNC_LOW_LATENCY 0x2000 /* Request low latency behaviour */
#define ASYNC_BUGGY_UART 0x4000 /* This is a buggy UART, skip some safety
* checks. Note: can be dangerous! */
...
So, it looks like 0x2000 is the right value -- better, just use
ASYNC_LOW_LATENCY.
To save some future reader some time, you need:
#include <sys/ioctl.h>
#include <linux/ioctl.h>
#include <linux/serial.h>
I tried it out and it works. Thanks!
- Chuck
next prev parent reply other threads:[~2003-11-21 23:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-20 21:38 DTD required (was Re: Trouble reading from my serial device ( a microcontroller)) Ed Vance
2003-11-21 2:47 ` Serial Howto suggestions (was Re: Trouble reading from my serial device...) Chuck Messenger
2003-11-21 5:29 ` Gary Frerking
2003-11-21 21:59 ` low_latency flag Chuck Messenger
2003-11-21 22:43 ` Jan-Benedict Glaw
2003-11-21 23:37 ` Chuck Messenger [this message]
2003-11-22 5:32 ` Serial Howto suggestions (was Re: Trouble reading from my serial device...) David Lawyer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='bpm6vr$86c$1@sea.gmane.org' \
--to=chuckm@rochester.rr.com \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox