Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* ioctl and device streams on OSF/1 3.0 rev 347
@ 1995-06-14  4:00 Robert Entrican 
  1995-06-16  4:00 ` Thomas M. Talpey
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Entrican  @ 1995-06-14  4:00 UTC (permalink / raw)



Help!

I can't believe I am having such a hard time try to get a very simple
program to perform basic dialer functions.  I have tried just about
every combination of c_cflag modes, and I am fresh out of ideas.  Am I
just stupid or has anybody else out there had difficulties getting
OSF/1 tty's to responds to read()'s and write()'s properly.

The program I am attempting to run is so short and simple it's
sickening.  All I am doing is opening the tty with O_RDWR|O_NDELAY and
then dropping into a tight loop.  The loop is basically to prompt me
for modem commands and I am then writting them to the descriptor
returned to me by the open ( tty , mode ) call.  Once I write the data,
I am calling ioctl ( fd , FIONREAD , &rawTag ) and it is supposed to
return to me the number of bytes at the stream head.  No matter what I
do, this function call returns me 0.  I then proceded to attempt to get
rid of the FIONREAD, and simply attempt to do the read ( fd , str, 256
) and this always returns me -1.  I am completely confused....  No
matter what flags I logically OR together in the c_cflags, c_iflags,
and c_oflags elements of termio, I never get the desired result...



PLease help, I am about to throw this AXP out the window....

Thank you.


Robert Entrican
(entrican@ix.netcom.com)
AppWorks Incorporated




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: ioctl and device streams on OSF/1 3.0 rev 347
  1995-06-14  4:00 ioctl and device streams on OSF/1 3.0 rev 347 Robert Entrican 
@ 1995-06-16  4:00 ` Thomas M. Talpey
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas M. Talpey @ 1995-06-16  4:00 UTC (permalink / raw)
  To: Robert Entrican 


In article <3rlq0v$gli@ixnews3.ix.netcom.com>, entrican@ix.netcom.com (Robert Entrican ) writes:
|> 
|> The program I am attempting to run is so short and simple it's
|> sickening.  All I am doing is opening the tty with O_RDWR|O_NDELAY and
|> then dropping into a tight loop....
|> I am calling ioctl ( fd , FIONREAD , &rawTag ) and it is supposed to
|> return to me the number of bytes at the stream head.  No matter what I
|> do, this function call returns me 0.  I then proceded to attempt to get
|> rid of the FIONREAD, and simply attempt to do the read ( fd , str, 256
|> ) and this always returns me -1....
|> No matter what flags I logically OR together in the c_cflags, c_iflags,
|> and c_oflags elements of termio, I never get the desired result...

You didn't include your code, so the best I can do is give you some
basic suggestions. First, OSF/1 tty's are Posix and therefore if you
follow Posix they work. Easier said than done, I know. Second, you
don't mention baud rates and the like, I assume you've set that and
not used the default. Third, using FIONREAD on tty's which are not
in ICANON mode is dicey, especially if you mix in VMIN and/or VTIME.
In these modes, bytes may be "held back" and not be present at the
stream head, but they are returned when read() is called. Also bytes
can be "taken back" if you do short reads. (The fact that you are
getting -1 from read() sounds like these aren't the case however,
assuming errno is EAGAIN).

I strongly suspect you're not setting CREAD, which would be the source
of your problem. CREAD is required by Posix to enable the receiver. If
you've been zeroing it, that would explain things, at least. Another
thing to check is that you've got a good cable connected to the right
port, of course! O_NDELAY will make this easy to miss.

Good luck...

Tom Talpey
tmt@hri.com.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1995-06-16  4:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-06-14  4:00 ioctl and device streams on OSF/1 3.0 rev 347 Robert Entrican 
1995-06-16  4:00 ` Thomas M. Talpey

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