ncurses tests

Chris Johns ccj at acm.org
Sun Jun 4 02:12:27 UTC 2000


Joel Sherrill wrote:
> 
> Eric Norum wrote:
> >
> > Now, where's the bug?   Should the smc1Initialize abide by the termios
> > speed?  Probably.  But then how would anyone get a power-up serial line
> > rate of anything other than 9600 baud?  I'd say that there's some
> > configuration information missing on startup -- but where to put it?
> 
> This is a hardware problem to solve in a general way.  Baud rate is
> but one termios harware setting (character size, parity, stop bits)
> even if one ignores the logical settings.   This makes me lean to
> being able to override the entire default termios settings.
> 
> But then there is the issue of default on a port per port basis.
> In many systems, there are more than more serial port.  I hate
> to create a solution for /dev/console and nothing else.
> 
> Maybe termios_open should ask the device driver for its initial
> hardware oriented settings for that port with a new termios handler.
> If the handler is NULL, then use 9600-8N1.
> 

Is this really needed ?

If I am going to use a termios port I will make sure my code initialises
every parameter I need set. What if I rely on a parameter and the
default changes ?

The console is the only termios port opened by RTEMS and for which the
issue exists. The first thing I do in my BSP code is :

  /*
   * Make the stdin stream baud rate what we expect as a default.
   */
  
  if (tcgetattr (STDIN_FILENO, &term) < 0)
  {
    printf ("rtems-target-init: cannot get terminal attributes.\n");
  }
  else
  {
    /*
     * Set the datasize and baudrate. Should do the lot at some stage.
     */

    term.c_cflag &= ~(CSIZE | CBAUD);
    term.c_cflag |= CS8 | B19200;
    
    if (tcsetattr (STDIN_FILENO, TCSANOW, &term) < 0)
      printf ("rtems-target-init: cannot set terminal attributes.\n");
  }
  
It is simple and standard.

-- 
 Chris Johns, mailto:ccj at acm.org



More information about the users mailing list