From patchwork Wed May 30 16:01:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Hrdina X-Patchwork-Id: 162029 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BA9D1B7058 for ; Thu, 31 May 2012 02:27:46 +1000 (EST) Received: from localhost ([::1]:47986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SZlLJ-0002DN-1a for incoming@patchwork.ozlabs.org; Wed, 30 May 2012 12:01:49 -0400 Received: from eggs.gnu.org ([208.118.235.92]:32852) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SZlKu-0001Gu-Nv for qemu-devel@nongnu.org; Wed, 30 May 2012 12:01:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SZlKk-0000EM-PQ for qemu-devel@nongnu.org; Wed, 30 May 2012 12:01:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61200) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SZlKk-0000D8-HW for qemu-devel@nongnu.org; Wed, 30 May 2012 12:01:14 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q4UG1DP9024509 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 30 May 2012 12:01:13 -0400 Received: from antique-laptop.brq.redhat.com (dhcp-27-171.brq.redhat.com [10.34.27.171]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q4UG19HU005177; Wed, 30 May 2012 12:01:12 -0400 From: Pavel Hrdina To: qemu-devel@nongnu.org Date: Wed, 30 May 2012 18:01:08 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Pavel Hrdina Subject: [Qemu-devel] [PATCH v2 2/2] qmp: revert "add set_echo implementation for qemu_chr_stdio" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This reverts commit bb002513a9bd2bff169c3d431a8f00c5b2e3aa99 because this code is not used in order that we use readline mode for '-qmp stdio'. Signed-off-by: Pavel Hrdina --- qemu-char.c | 26 ++++++++++---------------- 1 files changed, 10 insertions(+), 16 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index fe1126f..ba336f4 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -727,7 +727,6 @@ static void stdio_read(void *opaque) /* init terminal so that we can grab keys */ static struct termios oldtty; static int old_fd0_flags; -static bool stdio_allow_signal; static void term_exit(void) { @@ -735,24 +734,22 @@ static void term_exit(void) fcntl(0, F_SETFL, old_fd0_flags); } -static void qemu_chr_set_echo_stdio(CharDriverState *chr, bool echo) +static void term_init(QemuOpts *opts) { struct termios tty; tty = oldtty; - if (!echo) { - tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP + tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP |INLCR|IGNCR|ICRNL|IXON); - tty.c_oflag |= OPOST; - tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN); - tty.c_cflag &= ~(CSIZE|PARENB); - tty.c_cflag |= CS8; - tty.c_cc[VMIN] = 1; - tty.c_cc[VTIME] = 0; - } + tty.c_oflag |= OPOST; + tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN); /* if graphical mode, we allow Ctrl-C handling */ - if (!stdio_allow_signal) + if (!qemu_opt_get_bool(opts, "signal", display_type != DT_NOGRAPHIC)) tty.c_lflag &= ~ISIG; + tty.c_cflag &= ~(CSIZE|PARENB); + tty.c_cflag |= CS8; + tty.c_cc[VMIN] = 1; + tty.c_cc[VTIME] = 0; tcsetattr (0, TCSANOW, &tty); } @@ -781,12 +778,9 @@ static CharDriverState *qemu_chr_open_stdio(QemuOpts *opts) chr = qemu_chr_open_fd(0, 1); chr->chr_close = qemu_chr_close_stdio; - chr->chr_set_echo = qemu_chr_set_echo_stdio; qemu_set_fd_handler2(0, stdio_read_poll, stdio_read, NULL, chr); stdio_nb_clients++; - stdio_allow_signal = qemu_opt_get_bool(opts, "signal", - display_type != DT_NOGRAPHIC); - qemu_chr_fe_set_echo(chr, false); + term_init(opts); return chr; }