diff options
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 28 |
1 files changed, 23 insertions, 5 deletions
@@ -68,6 +68,7 @@ #include "exec/memory.h" #include "qmp-commands.h" #include "hmp.h" +#include "android-console.h" #include "qemu/thread.h" /* for pic/irq_info */ @@ -201,6 +202,8 @@ struct Monitor { void *password_opaque; mon_cmd_t *cmd_table; QError *error; + const char *prompt; + const char *banner; QLIST_HEAD(,mon_fd_t) fds; QLIST_ENTRY(Monitor) entry; }; @@ -214,6 +217,7 @@ static int mon_refcount; static mon_cmd_t mon_cmds[]; static mon_cmd_t info_cmds[]; +static mon_cmd_t android_cmds[]; static const mon_cmd_t qmp_cmds[]; @@ -245,7 +249,7 @@ void monitor_read_command(Monitor *mon, int show_prompt) if (!mon->rs) return; - readline_start(mon->rs, "(qemu) ", 0, monitor_command_cb, NULL); + readline_start(mon->rs, mon->prompt, 0, monitor_command_cb, NULL); if (show_prompt) readline_show_prompt(mon->rs); } @@ -2973,6 +2977,8 @@ static const mon_cmd_t qmp_cmds[] = { { /* NULL */ }, }; +#include "android-commands.h" + /*******************************************************************/ static const char *pch; @@ -3740,8 +3746,12 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon, cmd = search_dispatch_table(table, cmdname); if (!cmd) { - monitor_printf(mon, "unknown command: '%.*s'\n", - (int)(p - cmdline), cmdline); + if (mon->cmd_table == android_cmds) { + monitor_printf(mon, "KO: unknown command, try 'help'\n"); + } else { + monitor_printf(mon, "unknown command: '%.*s'\n", + (int)(p - cmdline), cmdline); + } return NULL; } @@ -5101,8 +5111,7 @@ static void monitor_event(void *opaque, int event) break; case CHR_EVENT_OPENED: - monitor_printf(mon, "QEMU %s monitor - type 'help' for more " - "information\n", QEMU_VERSION); + monitor_printf(mon, "%s\n", mon->banner); if (!mon->mux_out) { readline_show_prompt(mon->rs); } @@ -5175,6 +5184,15 @@ void monitor_init(CharDriverState *chr, int flags) mon = g_malloc(sizeof(*mon)); monitor_data_init(mon); + mon->prompt = "(qemu) "; + mon->banner = + "QEMU " QEMU_VERSION " monitor - type 'help' for more information"; + + if (flags & MONITOR_ANDROID_CONSOLE) { + mon->cmd_table = android_cmds; + mon->prompt = ""; + mon->banner = "Android Console: type 'help' for a list of commands"; + } mon->chr = chr; mon->flags = flags; |