diff -r 3ce6d719bfc0 monitor.c --- a/monitor.c Sat Dec 16 14:34:25 2006 -0600 +++ b/monitor.c Sat Dec 16 14:57:03 2006 -0600 @@ -2388,6 +2388,16 @@ static void term_read(void *opaque, cons readline_handle_byte(buf[i]); } +static void term_event(void *opaque, int event) +{ + if (event != CHR_EVENT_RESET) + return; + + term_printf("QEMU %s monitor - type 'help' for more information\n", + QEMU_VERSION); + readline_reset(); +} + static void monitor_start_input(void); static void monitor_handle_command1(void *opaque, const char *cmdline) @@ -2410,6 +2420,7 @@ void monitor_init(CharDriverState *hd, i } 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 ? */ diff -r 3ce6d719bfc0 readline.c --- a/readline.c Sat Dec 16 14:34:25 2006 -0600 +++ b/readline.c Sat Dec 16 14:37:52 2006 -0600 @@ -415,6 +415,11 @@ void readline_start(const char *prompt, term_show_prompt(); } +void readline_reset(void) +{ + term_show_prompt(); +} + const char *readline_get_history(unsigned int index) { if (index >= TERM_MAX_CMDS) diff -r 3ce6d719bfc0 vl.c --- a/vl.c Sat Dec 16 14:34:25 2006 -0600 +++ b/vl.c Sat Dec 16 14:57:20 2006 -0600 @@ -2399,6 +2399,8 @@ static void tcp_chr_connect(void *opaque s->connected = 1; qemu_set_fd_handler2(s->fd, tcp_chr_read_poll, tcp_chr_read, NULL, chr); + if (chr->chr_event) + chr->chr_event(chr, CHR_EVENT_RESET); } #define IACSET(x,a,b,c) x[0] = a; x[1] = b; x[2] = c; diff -r 3ce6d719bfc0 vl.h --- a/vl.h Sat Dec 16 14:34:25 2006 -0600 +++ b/vl.h Sat Dec 16 14:42:55 2006 -0600 @@ -240,7 +240,7 @@ void qemu_del_wait_object(HANDLE handle, #define CHR_EVENT_BREAK 0 /* serial break char */ #define CHR_EVENT_FOCUS 1 /* focus to this terminal (modal input needed) */ - +#define CHR_EVENT_RESET 2 /* new connection established */ #define CHR_IOCTL_SERIAL_SET_PARAMS 1 @@ -1334,6 +1334,7 @@ const char *readline_get_history(unsigne const char *readline_get_history(unsigned int index); void readline_start(const char *prompt, int is_password, ReadLineFunc *readline_func, void *opaque); +void readline_reset(void); void kqemu_record_dump(void);