Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: ellios@gatwick.geco-prakla.slb.com (Simon Elliott)
Subject: Re: Raw Serial Port
Date: 1996/10/28	[thread overview]
Message-ID: <551ri9$bgf@alpha.gatwick.Geco-Prakla.slb.com> (raw)
In-Reply-To: 326CDFC7.41C6@dba-sys.com


In article <326CDFC7.41C6@dba-sys.com>, richf@dba-sys.com says...
[SNIP]
>   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.

We're having this problem on Solaris 2.5. The standard POSIX way to get a raw 
serial port is as follows:

	struct termios MyTermios;
	int            MyFile;

	if (tcgetattr (MyFile, &MyTermios) == -1)
	/* error */

	MyTermios.c_cc[VMIN]  = 1;
	MyTermios.c_cc[VTIME] = 0;
	MyTermios.c_lflag &= ~(ECHO|ICANON|ISIG|ECHOE|ECHOK|ECHONL);
	MyTermios.c_oflag &= ~(OPOST);

	if (tcsetattr (MyFile, TCSANOW, &MyTermios) == -1)
	/* error */

You also probably want to get rid of xon/xoff processing and a few other 
undesirable things:

	MyTermios.c_iflag &= ~(BRKINT|ICRNL|INLCR|ISTRIP|IXOFF|IXON|PARMRK);

As far as I'm aware there is no standard POSIX way of disabling hardware flow 
control, should you want to do this.

I would be interested in hearing how this works out on your system.

Regards

Simon Elliott                                       Geco-Prakla
Senior Software Engineer                            Schlumberger House
Land Acquisition Technical Support                  Buckingham Gate
voice : +44 1293 55 6649                            GATWICK AIRPORT
fax   : +44 1293 55 6640                            RH6 0NZ
email : ellios@gatwick.geco-prakla.slb.com          United Kingdom





      reply	other threads:[~1996-10-28  5:00 UTC|newest]

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