diff options
author | Greg Bellows <greg.bellows@linaro.org> | 2014-11-18 16:47:39 -0600 |
---|---|---|
committer | Greg Bellows <greg.bellows@linaro.org> | 2014-11-20 11:19:26 -0600 |
commit | 8ada035948852b13f603b0961cce6408c7a00787 (patch) | |
tree | 6bdbc74d591a1e3f1b83a66f96c174f68d82c3a1 | |
parent | 70e3fbdb87862ba1c94a6a52d4bd7be3ee98edf1 (diff) |
android-console: Add avd status command
Add Android emulator console "avd status" commmand and associated help
messages.
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
-rw-r--r-- | android-commands.h | 7 | ||||
-rw-r--r-- | android-console.c | 18 | ||||
-rw-r--r-- | android-console.h | 1 |
3 files changed, 26 insertions, 0 deletions
diff --git a/android-commands.h b/android-commands.h index e3f1a67ab..46fdef50b 100644 --- a/android-commands.h +++ b/android-commands.h @@ -104,6 +104,13 @@ static mon_cmd_t android_event_cmds[] = { }; static mon_cmd_t android_avd_cmds[] = { + { + .name = "status", + .args_type = "", + .params = "", + .help = "query virtual device status", + .mhandler.cmd = android_console_avd_status, + }, { NULL, NULL, }, }; diff --git a/android-console.c b/android-console.c index ab7ea1339..036f674e0 100644 --- a/android-console.c +++ b/android-console.c @@ -23,6 +23,7 @@ #include "qmp-commands.h" #include "hw/misc/goldfish_battery.h" #include "hw/input/goldfish_events.h" +#include "sysemu/sysemu.h" typedef struct { int is_udp; @@ -713,6 +714,7 @@ void android_console_event(Monitor *mon, const QDict *qdict) enum { CMD_AVD, + CMD_AVD_STATUS, }; static const char *avd_help[] = { @@ -726,8 +728,18 @@ static const char *avd_help[] = { " avd status query virtual device status\n" " avd name query virtual device name\n" " avd snapshot state snapshot commands\n", + /* CMD_AVD_STATUS */ + "'avd status' will indicate whether the virtual device is running or not", }; +void android_console_avd_status(Monitor *mon, const QDict *qdict) +{ + monitor_printf(mon, "virtual device is %s\n", + runstate_is_running() ? "running" : "stopped"); + + monitor_printf(mon, "OK\n"); +} + void android_console_avd(Monitor *mon, const QDict *qdict) { /* This only gets called for bad subcommands and help requests */ @@ -736,6 +748,12 @@ void android_console_avd(Monitor *mon, const QDict *qdict) /* Default to the first entry which is the parent help message */ int cmd = CMD_AVD; + if (helptext) { + if (strstr(helptext, "status")) { + cmd = CMD_AVD_STATUS; + } + } + /* If this is not a help request then we are here with a bad sub-command */ monitor_printf(mon, "%s\n%s\n", avd_help[cmd], helptext ? "OK" : "KO: missing sub-command"); diff --git a/android-console.h b/android-console.h index 67a1bf6e7..49b9e907c 100644 --- a/android-console.h +++ b/android-console.h @@ -42,6 +42,7 @@ void android_console_event_send(Monitor *mon, const QDict *qdict); void android_console_event_text(Monitor *mon, const QDict *qdict); void android_console_event(Monitor *mon, const QDict *qdict); +void android_console_avd_status(Monitor *mon, const QDict *qdict); void android_console_avd(Monitor *mon, const QDict *qdict); void android_monitor_print_error(Monitor *mon, const char *fmt, ...); |