Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KOwJ6-0002Wv-Kj for qemu-devel@nongnu.org; Fri, 01 Aug 2008 11:12:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KOwJ5-0002WS-Sz for qemu-devel@nongnu.org; Fri, 01 Aug 2008 11:12:40 -0400 Received: from [199.232.76.173] (port=53253 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KOwJ5-0002WP-Q2 for qemu-devel@nongnu.org; Fri, 01 Aug 2008 11:12:39 -0400 Received: from savannah.gnu.org ([199.232.41.3]:39402 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KOwJ5-0007zd-5t for qemu-devel@nongnu.org; Fri, 01 Aug 2008 11:12:39 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KOwJ1-0008Dh-QT for qemu-devel@nongnu.org; Fri, 01 Aug 2008 15:12:35 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KOwJ1-0008D0-00 for qemu-devel@nongnu.org; Fri, 01 Aug 2008 15:12:35 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Fri, 01 Aug 2008 15:12:35 +0000 Subject: [Qemu-devel] [4979] Set focus to monitor to ask password if line is multiplexed ( Laurent Vivier) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 4979 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4979 Author: aliguori Date: 2008-08-01 15:12:34 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Set focus to monitor to ask password if line is multiplexed (Laurent Vivier) 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. Signed-off-by: Laurent Vivier Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/monitor.c trunk/vl.c Modified: trunk/monitor.c =================================================================== --- trunk/monitor.c 2008-08-01 15:04:00 UTC (rev 4978) +++ trunk/monitor.c 2008-08-01 15:12:34 UTC (rev 4979) @@ -2722,12 +2722,19 @@ 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 @@ 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]; + } } Modified: trunk/vl.c =================================================================== --- trunk/vl.c 2008-08-01 15:04:00 UTC (rev 4978) +++ trunk/vl.c 2008-08-01 15:12:34 UTC (rev 4979) @@ -8381,9 +8381,6 @@ } 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 @@ } } + 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;