Home/Support/Support Forum/Is tcgetbuffers used only with non-blocking mode?
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Is tcgetbuffers used only with non-blocking mode?

0 votes
If I open a serial port in blocking mode
fd1 = open ("/com/0", (O_RDWR|O_DMA));

and then later use tcgetbuffers I always get error no. 88 which is ENOSYS(function not supported) as
while(1)
{
retbuf = tcgetbuffers(fd1, &bufs);
if (retbuf < 0)
{
printf("Error no.= %d\n", getErrno());
tx_thread_sleep(100);
continue;
}
}

Can tcgetbuffers not be used with blocking operations?
asked Dec 8, 2006 in NET+OS by maverick13 New to the Community (5 points)
recategorized Dec 18, 2013 by tuxembb

Please log in or register to answer this question.

2 Answers

0 votes
I never got it to work right on NetOS 6.0.

Since you are using a while() loop anyway, you could just wait calling tx_thread_sleep(1) repeatedly until tcgetbuffers() returns that there is data (bufs.rxbuf>0).
answered Dec 12, 2006 by egawtry Veteran of the Digi Community (349 points)
0 votes
Why don't you use:

A) blocking reads in a separate thread
or
B) non-blocking reads and check how many bytes have been read

It seems simpler to me...

My 2 cents,
PC
answered Jan 3, 2007 by PC New to the Community (32 points)
...