aboutsummaryrefslogtreecommitdiffstats
path: root/monitor.c
diff options
context:
space:
mode:
authorDavid Turner <digit@android.com>2010-09-10 13:02:07 +0200
committerDavid 'Digit' Turner <digit@android.com>2010-09-13 00:30:35 -0700
commit9d1188280fa5294f9438424e5e8eae91f645bfd8 (patch)
treef50f39aa43923a3c407ec55d72e5031a5aa45e21 /monitor.c
parent622311e8dfe485ba588b570c69d66e71d9624104 (diff)
downloadexternal_qemu-9d1188280fa5294f9438424e5e8eae91f645bfd8.zip
external_qemu-9d1188280fa5294f9438424e5e8eae91f645bfd8.tar.gz
external_qemu-9d1188280fa5294f9438424e5e8eae91f645bfd8.tar.bz2
upstream: qemu-char updates.
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/monitor.c b/monitor.c
index fb4d907..9de414a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -74,6 +74,8 @@ typedef struct mon_cmd_t {
struct Monitor {
CharDriverState *chr;
+ int mux_out;
+ int reset_seen;
int flags;
int suspend_cnt;
uint8_t outbuf[1024];
@@ -136,7 +138,7 @@ static int monitor_read_password(Monitor *mon, ReadLineFunc *readline_func,
void monitor_flush(Monitor *mon)
{
- if (mon && mon->outbuf_index != 0 && mon->chr->focus == 0) {
+ if (mon && mon->outbuf_index != 0 && !mon->mux_out) {
qemu_chr_write(mon->chr, mon->outbuf, mon->outbuf_index);
mon->outbuf_index = 0;
}
@@ -3035,23 +3037,36 @@ static void monitor_event(void *opaque, int event)
switch (event) {
case CHR_EVENT_MUX_IN:
- readline_restart(mon->rs);
- monitor_resume(mon);
- monitor_flush(mon);
+ mon->mux_out = 0;
+ if (mon->reset_seen) {
+ readline_restart(mon->rs);
+ monitor_resume(mon);
+ monitor_flush(mon);
+ } else {
+ mon->suspend_cnt = 0;
+ }
break;
case CHR_EVENT_MUX_OUT:
- if (mon->suspend_cnt == 0)
- monitor_printf(mon, "\n");
- monitor_flush(mon);
- monitor_suspend(mon);
+ if (mon->reset_seen) {
+ if (mon->suspend_cnt == 0) {
+ monitor_printf(mon, "\n");
+ }
+ monitor_flush(mon);
+ monitor_suspend(mon);
+ } else {
+ mon->suspend_cnt++;
+ }
+ mon->mux_out = 1;
break;
case CHR_EVENT_OPENED:
monitor_printf(mon, "QEMU %s monitor - type 'help' for more "
"information\n", QEMU_VERSION);
- if (mon->chr->focus == 0)
+ if (!mon->mux_out) {
readline_show_prompt(mon->rs);
+ }
+ mon->reset_seen = 1;
break;
}
}
@@ -3079,8 +3094,6 @@ void monitor_init(CharDriverState *chr, int flags)
mon->chr = chr;
mon->flags = flags;
- if (mon->chr->focus != 0)
- mon->suspend_cnt = 1; /* mux'ed monitors start suspended */
if (flags & MONITOR_USE_READLINE) {
mon->rs = readline_init(mon, monitor_find_completion);
monitor_read_command(mon, 0);