Console question

Ian Caddy ianc at microsol.iinet.net.au
Thu Nov 4 03:12:13 UTC 2004


Hi Etienne,

I had a very similar problem to this a few days ago, although we are 
using 4.5.0 I would say you are having the same problem.

I found that when I set my serial parameters using tcsetattr to provide 
a character timeout, that is:

       term.c_cc[VMIN]  = 0;
       term.c_cc[VTIME] = 5;

No minimum character, with a timeout of 500ms.  The problem only seems 
to occur with a timeout set for termios on the read.

Using fgetc, as soon as I had a timeout from termios, it was all over 
and I got EOF returned from fgetc whenever I called it without even a 
timeout.

This fgetc is in newlib and if it gets returned 0 characters from the 
lower levels, it marks that it is at the end of the file.  After this 
time, even if new characters come into termios, it still returns EOF 
straight away, not even waiting for the timeout.

regards,

Ian Caddy



Etienne Fortin wrote:
> Hi Eric,
> Thanks for the reply. I'm using ICANON=0. I assumed that since I receive
> binary data, I don't want any processing on the inputted data. Am I
> right about ICANON and that requirement?
> 
> Etienne Fortin
> Sensio
> 
> 
> -----Message d'origine-----
> De : Eric Norum [mailto:norume at aps.anl.gov] 
> Envoyé : 3 novembre, 2004 14:37
> À : Etienne Fortin
> Cc : rtems-users at rtems.com
> Objet : Re: Console question
> 
> 
> Etienne Fortin wrote:
> 
>>Hi everyone,
>>Question: What can cause the fact that characters pushed into the 
>>console by rtems_termios_enqueue_raw_characters() are not "seen" by 
>>fgetc(stdin)?
>>
>>Situation: I can get some characters from stdin by using both fgetc() 
>>fread(). After some characters are received (about 1k), the received 
>>characters are pushed into the console (I single stepped the interrupt
> 
> 
>>handler and rtems_termios_enqueue_raw_characters() is called), fgetc()
> 
> 
>>repeatedly returns EOF.
>>
>>Anyone with experience with a similar problem? Can it has to do with 
>>the fact that stdin is line buffered?
> 
> Probably.
> 
> Are you using cooked (ICANON=1) or raw (ICANON=0) input?  The cooked
> buffer is 
> not unlimited.



More information about the users mailing list