From: Laurent Vivier <Laurent.Vivier@bull.net>
To: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: [Qemu-devel] [PATCH] qemu: set focus to monitor to ask password if line is multiplexed
Date: Thu, 31 Jul 2008 13:32:17 +0200 [thread overview]
Message-ID: <1217503937.3879.25.camel@frecb07144> (raw)
[-- Attachment #1: Type: text/plain, Size: 603 bytes --]
This patch allows to display the "Password:" prompt if we use encrypted
disk with "-nographic" option.
It also modifies management of "-nographic" to not override user's
choices for "-serial", "-parallel" and "-monitor".
When qemu has to ask a password with "-nographic" with a multiplexed
serial interface, it forces the focus to the monitor and restore
original focus after.
Regards,
Laurent
--
----------------- Laurent.Vivier@bull.net ------------------
"La perfection est atteinte non quand il ne reste rien à
ajouter mais quand il ne reste rien à enlever." Saint Exupéry
[-- Attachment #2: nographic.patch --]
[-- Type: text/x-vhdl, Size: 2345 bytes --]
---
monitor.c | 17 +++++++++++++++--
vl.c | 12 +++++++++---
2 files changed, 24 insertions(+), 5 deletions(-)
Index: qemu/vl.c
===================================================================
--- qemu.orig/vl.c 2008-07-31 12:52:26.000000000 +0200
+++ qemu/vl.c 2008-07-31 12:53:04.000000000 +0200
@@ -8381,9 +8381,6 @@ int main(int argc, char **argv)
}
break;
case QEMU_OPTION_nographic:
- serial_devices[0] = "stdio";
- parallel_devices[0] = "null";
- monitor_device = "stdio";
nographic = 1;
break;
#ifdef CONFIG_CURSES
@@ -8781,6 +8778,15 @@ int main(int argc, char **argv)
}
}
+ if (nographic) {
+ if (serial_device_index == 0)
+ serial_devices[0] = "stdio";
+ if (parallel_device_index == 0)
+ parallel_devices[0] = "null";
+ if (strncmp(monitor_device, "vc", 2) == 0)
+ monitor_device = "stdio";
+ }
+
#ifndef _WIN32
if (daemonize) {
pid_t pid;
Index: qemu/monitor.c
===================================================================
--- qemu.orig/monitor.c 2008-07-31 12:52:26.000000000 +0200
+++ qemu/monitor.c 2008-07-31 12:57:44.000000000 +0200
@@ -2722,12 +2722,19 @@ void monitor_readline(const char *prompt
char *buf, int buf_size)
{
int i;
+ int old_focus[MAX_MON];
if (is_password) {
- for (i = 0; i < MAX_MON; i++)
- if (monitor_hd[i] && monitor_hd[i]->focus == 0)
+ for (i = 0; i < MAX_MON; i++) {
+ old_focus[i] = 0;
+ if (monitor_hd[i]) {
+ old_focus[i] = monitor_hd[i]->focus;
+ monitor_hd[i]->focus = 0;
qemu_chr_send_event(monitor_hd[i], CHR_EVENT_FOCUS);
+ }
+ }
}
+
readline_start(prompt, is_password, monitor_readline_cb, NULL);
monitor_readline_buf = buf;
monitor_readline_buf_size = buf_size;
@@ -2735,4 +2742,10 @@ void monitor_readline(const char *prompt
while (monitor_readline_started) {
main_loop_wait(10);
}
+ /* restore original focus */
+ if (is_password) {
+ for (i = 0; i < MAX_MON; i++)
+ if (old_focus[i])
+ monitor_hd[i]->focus = old_focus[i];
+ }
}
next reply other threads:[~2008-07-31 11:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-31 11:32 Laurent Vivier [this message]
2008-08-01 14:53 ` [Qemu-devel] Re: [PATCH] qemu: set focus to monitor to ask password if line is multiplexed Anthony Liguori
2008-08-01 15:06 ` Laurent Vivier
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=1217503937.3879.25.camel@frecb07144 \
--to=laurent.vivier@bull.net \
--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).