From e7d06758120d8753bb1b46be9461a4a247a28af8 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 19 Aug 2005 16:19:48 +0000 Subject: 2005-08-19 Cedric Aubert PR 577/bsps * console.c: The console_close() method currently calls StopRemoteTx() on all invocations. It should should be ok for last close only but not for any others. If you open a port multiple times, you only want to call StopRemoteTx() only as part of the last close. --- c/src/lib/libbsp/shared/ChangeLog | 8 ++++++++ c/src/lib/libbsp/shared/console.c | 13 +++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'c') diff --git a/c/src/lib/libbsp/shared/ChangeLog b/c/src/lib/libbsp/shared/ChangeLog index 3218f4b7db..b79628c8c1 100644 --- a/c/src/lib/libbsp/shared/ChangeLog +++ b/c/src/lib/libbsp/shared/ChangeLog @@ -1,3 +1,11 @@ +2005-08-19 Cedric Aubert + + PR 577/bsps + * console.c: The console_close() method currently calls StopRemoteTx() + on all invocations. It should should be ok for last close only but + not for any others. If you open a port multiple times, you only want + to call StopRemoteTx() only as part of the last close. + 2005-04-15 Jennifer Averett PR 779/bsp diff --git a/c/src/lib/libbsp/shared/console.c b/c/src/lib/libbsp/shared/console.c index c897544a79..e294fc1714 100644 --- a/c/src/lib/libbsp/shared/console.c +++ b/c/src/lib/libbsp/shared/console.c @@ -128,10 +128,15 @@ rtems_device_driver console_close( { rtems_libio_open_close_args_t *args = arg; - if ( (args->iop->flags&LIBIO_FLAGS_READ) && - Console_Port_Tbl[minor].pDeviceFlow && - Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx) { - Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx(minor); + /* Get the tty refcount to determine if we need to do deviceStopRemoteTx. + * Stop only if it's the last one opened. + */ + if ( (current_tty->refcount == 1) ) { + if ( (args->iop->flags&LIBIO_FLAGS_READ) && + Console_Port_Tbl[minor].pDeviceFlow && + Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx) { + Console_Port_Tbl[minor].pDeviceFlow->deviceStopRemoteTx(minor); + } } return rtems_termios_close (arg); -- cgit v1.2.3