🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sgi.hardware
Article #135

Re: Help with serial/tty2 communication (write ok, read NOT).

#135
From: Troy Stephen
Date: Mon, 12 Feb 1996 06:06
84 lines
3097 bytes

Hi guys,

I have a similar problem, and thought it might as well continue on this thread.

I am using a configuration almost exactly the same as the one you have
suggested below.  The only differences being:
    
 port = open("/dev/ttyd2", O_RDWR);

 t.c_cc[VMIN] = 27;
 t.c_cc[VTIME] = 0;

I'm reading 27 byte packets and I want the read to block until it gets
a complete packet.  I think the man page mentions that with this
configuration, it is possible for the read to block indefinitely,
however I haven't witnessed this yet.  What I am seeing though, is that
sometimes the read returns prematurely without all 27 bytes, and I need
to send it back to get the rest. Why is this so?  What could be causing
it to return early?

Also, I am a bit concerned about the reliability of the serial ports at
high baud rates, especially when the man page for SERIAL(7) says:

"...Each line may be independently set to run at any of several speeds,
as high as 19,200 or even 38,400 bps."

What are people's experience with this?  I need to run at 38.4kbaud and
my application needs to read the 27 byte packets at 60hz.  What are my
chances of getting this to work reliably?


Regards,
Troy Stephen
troys@wormald.com.au

PS. I'm using a deskside ONYX with IRIX 5.2



In article <4ef62p$8t2@ni1.ni.net> Tom Benoist <ben@ifx.com> writes:

> From: Tom Benoist <ben@ifx.com>
> Newsgroups: comp.sys.sgi.hardware,comp.lang.c++
> Date: 28 Jan 1996 06:45:45 GMT
> Organization: Interactive Effects
> X-URL: news:4ebkuaINNdqp@retriever.cs.umbc.edu
> 
> Its pretty difficult to see what your doing wrong since,
> 1. you didnt show your ioctl setup.
> 2. You didnt mention if you understood the implications of O_NONBLOCK
>    (ie...your reads return FALSE until a byte is available)
> 
> In any case, the following works for most applications.....
> 
> -Tom
> 
> 
> 
>     int port;
>     struct termio t;
> 
> 
>     port = open("/dev/ttyd2", O_RDWR | O_NDELAY, 0666);
>     t.c_iflag = IGNBRK;
>     t.c_oflag = 0;
> 
>     t.c_cflag = B38400 | CS8 | CREAD | CLOCAL;
>     t.c_lflag = 0;
> 
>     t.c_cc[VMIN] = 1;
>     t.c_cc[VTIME] = 1;
> 
>     t.c_iflag &=~(IXON | IXOFF | IXANY);
> 
>     ioctl(port, TCSETAW, &t);
> 
> 
> -- 
> _____________________________________________________________________
> Tom Benoist                                        Email: ben@ifx.com 
> Interactive Effects                      Amazon http://www.ifx.com/ie
> 
Technical Details
Message-ID: <TROYS.96Feb12160640@donald.wormald.com.au>
Path: arc1-ca.pugleaf.net!zebedee.wormald.com.au!news
References: <4ebkuaINNdqp@retriever.cs.umbc.edu> <4ef62p$8t2@ni1.ni.net>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.sgi.hardware,comp.lang.c++
Path: arc1-ca.pugleaf.net!zebedee.wormald.com.au!news
From: troys@donald.wormald.com.au (Troy Stephen)
Subject: Re: Help with serial/tty2 communication (write ok, read NOT).
In-Reply-To: Tom Benoist's message of 28 Jan 1996 06:45:45 GMT
Message-ID: <TROYS.96Feb12160640@donald.wormald.com.au>
Sender: news@wormald.com.au (Login account for news)
Nntp-Posting-Host: donald
Organization: Wormald Technology, Sydney, Australia
References: <4ebkuaINNdqp@retriever.cs.umbc.edu> <4ef62p$8t2@ni1.ni.net>
Date: Mon, 12 Feb 1996 06:06:39 GMT