From 9f8f97f528313ef58315bbd7a81faa44a8e07cd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 1 Nov 2004 03:55:53 +0000 Subject: [PATCH] tty_write_to_tty() used the wrong TTY to look at the ECHO flag; also added a comment that explains why the other TTY has to be chosen there. Improved debug output. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9698 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/tty/tty.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/add-ons/kernel/drivers/tty/tty.cpp b/src/add-ons/kernel/drivers/tty/tty.cpp index 9c376a06af..b312625777 100644 --- a/src/add-ons/kernel/drivers/tty/tty.cpp +++ b/src/add-ons/kernel/drivers/tty/tty.cpp @@ -458,7 +458,9 @@ tty_ioctl(struct tty *tty, uint32 op, void *buffer, size_t length) case TCSETA: case TCSETAW: case TCSETAF: - TRACE(("tty: set attributes\n")); + TRACE(("tty: set attributes (iflag = %lx, oflag = %lx, cflag = %lx, lflag = %lx)\n", + tty->termios.c_iflag, tty->termios.c_oflag, tty->termios.c_cflag, tty->termios.c_lflag)); + return user_memcpy(&tty->termios, buffer, sizeof(struct termios)); /* get and set process group ID */ @@ -544,7 +546,11 @@ tty_write_to_tty(struct tty *source, struct tty *target, const void *buffer, siz size_t length = *_length; size_t bytesWritten = 0; bool dontBlock = (mode & O_NONBLOCK) != 0; - bool echo = (source->termios.c_lflag & ECHO) != 0; + + bool echo = (target->termios.c_lflag & ECHO) != 0; + // Confusingly enough, we need to echo when the target's ECHO flag is + // set. That's because our target is supposed to echo back at us, not + // to itself. // ToDo: "buffer" is not yet copied or accessed in a safe way! @@ -601,16 +607,18 @@ tty_write_to_tty(struct tty *source, struct tty *target, const void *buffer, siz } -status_t +status_t tty_select(struct tty *tty, uint8 event, uint32 ref, selectsync *sync) { + TRACE(("tty_select(event = %u, ref = %lu, sync = %p\n", event, ref, sync)); return B_OK; } -status_t +status_t tty_deselect(struct tty *tty, uint8 event, selectsync *sync) { + TRACE(("tty_deselect(event = %u, sync = %p\n", event, sync)); return B_OK; }