diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2003-09-26 17:34:21 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2003-09-26 17:34:21 +0000 |
commit | e9051435e8e251afc25dbb7c1876f1d24011addd (patch) | |
tree | 898d68244152b41f8cbcee440c9f4758aee55f41 /c/src/lib/libbsp/shared/console.c | |
parent | 2003-09-26 Joel Sherrill <joel@OARcorp.com> (diff) | |
download | rtems-e9051435e8e251afc25dbb7c1876f1d24011addd.tar.bz2 |
2003-09-26 Cedric Aubert <cedric_aubert@yahoo.fr>
PR 501/rtems_misc
* console.c: console_open disables ICANON on non-console port, which
should be ok for the first open but not for subsequent ones. If you
open one serial port, you will configure it, when you reopen it you
will lost the ICANON parameters if you had put it. Should be done by
console only at first open.
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libbsp/shared/console.c | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/c/src/lib/libbsp/shared/console.c b/c/src/lib/libbsp/shared/console.c index 7623b7c628..0f59a17231 100644 --- a/c/src/lib/libbsp/shared/console.c +++ b/c/src/lib/libbsp/shared/console.c @@ -20,6 +20,7 @@ #include <assert.h> #include <termios.h> +#include <rtems/termiostypes.h> #include <libchip/serial.h> /* @@ -50,6 +51,7 @@ rtems_device_driver console_open( struct termios Termios; rtems_termios_callbacks Callbacks; console_tbl *cptr; + struct rtems_termios_tty *current_tty; /* * Verify the port number is valid. @@ -79,19 +81,27 @@ rtems_device_driver console_open( status = rtems_termios_open ( major, minor, arg, &Callbacks ); Console_Port_Data[minor].termios_data = args->iop->data1; - - if (minor!=Console_Port_Minor) { - /* - * If this is not the console we do not want ECHO and - * so forth - */ - IoctlArgs.iop=args->iop; - IoctlArgs.command=RTEMS_IO_GET_ATTRIBUTES; - IoctlArgs.buffer=&Termios; - rtems_termios_ioctl(&IoctlArgs); - Termios.c_lflag=ICANON; - IoctlArgs.command=RTEMS_IO_SET_ATTRIBUTES; - rtems_termios_ioctl(&IoctlArgs); + + /* Get tty pointeur from the Console_Port_Data */ + current_tty = Console_Port_Data[minor].termios_data; + + if ( (current_tty->refcount == 1) ) { + /* + * If it's the first open, modified, if need, the port parameters + */ + if (minor!=Console_Port_Minor) { + /* + * If this is not the console we do not want ECHO and + * so forth + */ + IoctlArgs.iop=args->iop; + IoctlArgs.command=RTEMS_IO_GET_ATTRIBUTES; + IoctlArgs.buffer=&Termios; + rtems_termios_ioctl(&IoctlArgs); + Termios.c_lflag=ICANON; + IoctlArgs.command=RTEMS_IO_SET_ATTRIBUTES; + rtems_termios_ioctl(&IoctlArgs); + } } if ( (args->iop->flags&LIBIO_FLAGS_READ) && |