From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>
Subject: [Qemu-devel] [PATCH] make -qmp stdio usable
Date: Wed, 11 Aug 2010 17:56:06 -0400 [thread overview]
Message-ID: <1281563766-19391-1-git-send-email-pbonzini@redhat.com> (raw)
Currently -qmp stdio (or the equivalent -mon/-chardev combination) sets
up the terminal attributes even though it does not go through readline
to actually do I/O. As a result, echo is disabled and you cannot see
anything you type. This patch fixes it by adding a "cooked" option to
the stdio chardev backend, that when set will disable switching the tty
to raw mode.
Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
qemu-char.c | 26 ++++++++++++++------------
qemu-config.c | 3 +++
vl.c | 3 +++
3 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index 6a3952c..15e1891 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -735,19 +735,21 @@ static void term_init(QemuOpts *opts)
oldtty = tty;
old_fd0_flags = fcntl(0, F_GETFL);
- tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
+ if (!qemu_opt_get_bool(opts, "cooked", 0)) {
+ tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
|INLCR|IGNCR|ICRNL|IXON);
- tty.c_oflag |= OPOST;
- tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
- /* if graphical mode, we allow Ctrl-C handling */
- 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);
+ tty.c_oflag |= OPOST;
+ tty.c_lflag &= ~(ECHO|ECHONL|ICANON|IEXTEN);
+ /* if graphical mode, we allow Ctrl-C handling */
+ 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);
+ }
if (!term_atexit_done++)
atexit(term_exit);
diff --git a/qemu-config.c b/qemu-config.c
index 95abe61..8c525b0 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -146,6 +146,9 @@ QemuOptsList qemu_chardev_opts = {
},{
.name = "signal",
.type = QEMU_OPT_BOOL,
+ },{
+ .name = "cooked",
+ .type = QEMU_OPT_BOOL,
},
{ /* end if list */ }
},
diff --git a/vl.c b/vl.c
index b3e3676..be122e7 100644
--- a/vl.c
+++ b/vl.c
@@ -1596,6 +1596,9 @@ static void monitor_parse(const char *optarg, const char *mode)
fprintf(stderr, "parse error: %s\n", optarg);
exit(1);
}
+ if (!strcmp(mode, "control")) {
+ qemu_opt_set(opts, "cooked", "on");
+ }
}
opts = qemu_opts_create(&qemu_mon_opts, label, 1);
--
1.7.1
next reply other threads:[~2010-08-11 21:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-11 21:56 Paolo Bonzini [this message]
2010-08-22 21:50 ` [Qemu-devel] [PATCH] make -qmp stdio usable Anthony Liguori
2010-08-23 6:22 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1281563766-19391-1-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).