termios & binary data

Joel Sherrill joel at oarcorp.com
Thu May 7 14:14:28 UTC 1998




> So, as, I quote termio man page, "Normally, terminal input is
> processed in
> units of lines", how could we do binary I/O with termios? There's a 
> non-canonical mode input processing, but is it implemented?

It looks like it is too me.  Looking at opost(), if OPOST is not set, then
the character is sent directly out.  

Similarly in iproc(), if the various input mode things are not set, then
the character is simply stuffed into the input buffer.

>From an efficiency view, opost() looks pretty lean when it does not do
anything.  ipost() makes a few checks which could be short-circuited by
wrapping all the checking code in a check to see if c_iflag has any input
processing bits set.  I seem to recall that the Interactive V.3 tty driver
did something like this years ago (mid-80's).  That tty driver had other
rearrangements from the vanilla AT&T V.3 source but was also substantially
faster (20% if I remember right).

> I also would need these things:
> 1. read a given number of bytes from an uart
> 2. blocking/non-blocking read

The termios test gives examples of both of these cases.  They work just as
in your favorite UNIX. :)

We do not have 100% termios functionality but most of what is normally
used is actually implemented. 

--joel





More information about the users mailing list