Commit bc0129d97804615fbcf3281fe30361ab8aa8f4ab
1 parent
e94f3a60
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 <Laurent.Vivier@bull.net> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4979 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
24 additions
and
5 deletions
monitor.c
... | ... | @@ -2722,12 +2722,19 @@ void monitor_readline(const char *prompt, int is_password, |
2722 | 2722 | char *buf, int buf_size) |
2723 | 2723 | { |
2724 | 2724 | int i; |
2725 | + int old_focus[MAX_MON]; | |
2725 | 2726 | |
2726 | 2727 | if (is_password) { |
2727 | - for (i = 0; i < MAX_MON; i++) | |
2728 | - if (monitor_hd[i] && monitor_hd[i]->focus == 0) | |
2728 | + for (i = 0; i < MAX_MON; i++) { | |
2729 | + old_focus[i] = 0; | |
2730 | + if (monitor_hd[i]) { | |
2731 | + old_focus[i] = monitor_hd[i]->focus; | |
2732 | + monitor_hd[i]->focus = 0; | |
2729 | 2733 | qemu_chr_send_event(monitor_hd[i], CHR_EVENT_FOCUS); |
2734 | + } | |
2735 | + } | |
2730 | 2736 | } |
2737 | + | |
2731 | 2738 | readline_start(prompt, is_password, monitor_readline_cb, NULL); |
2732 | 2739 | monitor_readline_buf = buf; |
2733 | 2740 | monitor_readline_buf_size = buf_size; |
... | ... | @@ -2735,4 +2742,10 @@ void monitor_readline(const char *prompt, int is_password, |
2735 | 2742 | while (monitor_readline_started) { |
2736 | 2743 | main_loop_wait(10); |
2737 | 2744 | } |
2745 | + /* restore original focus */ | |
2746 | + if (is_password) { | |
2747 | + for (i = 0; i < MAX_MON; i++) | |
2748 | + if (old_focus[i]) | |
2749 | + monitor_hd[i]->focus = old_focus[i]; | |
2750 | + } | |
2738 | 2751 | } | ... | ... |
vl.c
... | ... | @@ -8381,9 +8381,6 @@ int main(int argc, char **argv) |
8381 | 8381 | } |
8382 | 8382 | break; |
8383 | 8383 | case QEMU_OPTION_nographic: |
8384 | - serial_devices[0] = "stdio"; | |
8385 | - parallel_devices[0] = "null"; | |
8386 | - monitor_device = "stdio"; | |
8387 | 8384 | nographic = 1; |
8388 | 8385 | break; |
8389 | 8386 | #ifdef CONFIG_CURSES |
... | ... | @@ -8781,6 +8778,15 @@ int main(int argc, char **argv) |
8781 | 8778 | } |
8782 | 8779 | } |
8783 | 8780 | |
8781 | + if (nographic) { | |
8782 | + if (serial_device_index == 0) | |
8783 | + serial_devices[0] = "stdio"; | |
8784 | + if (parallel_device_index == 0) | |
8785 | + parallel_devices[0] = "null"; | |
8786 | + if (strncmp(monitor_device, "vc", 2) == 0) | |
8787 | + monitor_device = "stdio"; | |
8788 | + } | |
8789 | + | |
8784 | 8790 | #ifndef _WIN32 |
8785 | 8791 | if (daemonize) { |
8786 | 8792 | pid_t pid; | ... | ... |