aboutsummaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-01-05 22:01:59 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-01-05 22:01:59 +0000
commit86e94dea5b740dad65446c857f6959eae43e0ba6 (patch)
tree7870bef3144c93a02c99751d7653d8492c1f2282 /monitor.c
parent8f28f3fbbe1116c5f4f11ebf4167a770032e2606 (diff)
Reinitialize monitor upon reconnect, by Anthony Liguori.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2300 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/monitor.c b/monitor.c
index da9b49239c..6cb1c38fb7 100644
--- a/monitor.c
+++ b/monitor.c
@@ -55,6 +55,7 @@ typedef struct term_cmd_t {
} term_cmd_t;
static CharDriverState *monitor_hd;
+static int hide_banner;
static term_cmd_t term_cmds[];
static term_cmd_t info_cmds[];
@@ -2438,15 +2439,24 @@ static void monitor_start_input(void)
readline_start("(qemu) ", 0, monitor_handle_command1, NULL);
}
+static void term_event(void *opaque, int event)
+{
+ if (event != CHR_EVENT_RESET)
+ return;
+
+ if (!hide_banner)
+ term_printf("QEMU %s monitor - type 'help' for more information\n",
+ QEMU_VERSION);
+ monitor_start_input();
+}
+
void monitor_init(CharDriverState *hd, int show_banner)
{
monitor_hd = hd;
- if (show_banner) {
- term_printf("QEMU %s monitor - type 'help' for more information\n",
- QEMU_VERSION);
- }
+ hide_banner = !show_banner;
+
qemu_chr_add_read_handler(hd, term_can_read, term_read, NULL);
- monitor_start_input();
+ qemu_chr_add_event_handler(hd, term_event);
}
/* XXX: use threads ? */