Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: "Richard W. Franzen" <richf@dba-sys.com>
Cc: richf@dba-sys.com
Subject: Raw Serial Port
Date: 1996/10/22	[thread overview]
Message-ID: <326CDFC7.41C6@dba-sys.com> (raw)


Under the old SunOS 4.x.x, one could obtain a raw serial device
(no os interceptions of data between device and application) using
ioctl() calls and the sgttyb structure:

        status = ioctl(fd, TIOCGETP, &mygtty);
        ..
        mygtty.sg_flags |= RAW;
        mygtty.sg_flags &= ~(ECHO);
        ..
        status = ioctl(fd, TIOCSETP, &mygtty);

   Now there is the new & better & standard & Posix & @$%@#^% termios
infrastructure.  None of the documentation I can find states, "here is
how you have the goshdarn os leave serial data alone", so we are trying
to translate the above using then information in the termios man
page.  So far, we have:

        status = tcgetattr(fd, &myAttr);
        ..
        myAttr.c_iflag &= (IXOFF | IXANY);
        myAttr.c_oflag &= ~(OPOST);
        myAttr.c_cflag &= ~(PARENB | PARODD | CSTOPB);
        myAttr.c_cflag |= (CS8 | CLOCAL);
        myAttr.c_lflag &= ~(XCASE | ICANON | ISIG);
        myAttr.c_lflag &= ~(ECHO);
        ..
        myAttr.c_cc[VMIN]  = 1;
        myAttr.c_cc(VTIME] = 0;
        ..
        status = tcsetattr(fd, TCSANOW, &myAttr);

which, unfortunately, does not work as we would like.  Certain
characters from the device still get eaten by the os.  The serial
protocol we use was designed a long time ago, assuming pure binary
data could be passed between Unix and the device.

   It is extremely likely that we are not setting\clearing something
which we should be.  Unfortunately, it is not clear what.  Six months
ago we solved the problem by giving up on the new way and using the
Solaris -> SunOS compatibility stuff (including <sys/ttold.h> and
<sys/ttcompat.h>), which allowed the use of the sgttyb stuff.  This
works fine.

   Now we are porting to Digital Unix 4.0, which obviously does not
bother with SunOS backwards compatibility.  (They do document
BSD compatibity methods for code using sgttyb, but it is not
the same as Sun implemented it.)  The "right" way to go should be to
use the new Posix termios method for controlling the serial port.
So, if anyone knows the magic Posix incantation to have Unix not do
any filtering of serial data--period--please share the spell.

   Thanks,      Rich

 

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Rich Franzen		 richf@dba-sys.com	(work)
Staff Scientist		 rfranzen@digital.net	(home)
DBA Systems, Inc.	 407/727-0660 x2294	(voice)
1200 S. Woody Burke Rd.	 407/727-7019		(fax)
Melbourne, FL  32901	 {`DBA' != "doing business as"}



             reply	other threads:[~1996-10-22  4:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-22  4:00 Richard W. Franzen [this message]
1996-10-28  5:00 ` Raw Serial Port Simon Elliott
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox