diff options
author | Greg Bellows <greg.bellows@linaro.org> | 2014-11-18 16:31:31 -0600 |
---|---|---|
committer | Greg Bellows <greg.bellows@linaro.org> | 2014-11-20 11:19:26 -0600 |
commit | 70e3fbdb87862ba1c94a6a52d4bd7be3ee98edf1 (patch) | |
tree | 59a004f54b924a8b381b6bf6fea73d6ef8bf1c1c | |
parent | 74831e12e27e73ead651008dd9beb1a0a23aac9d (diff) |
android-console: Add base avd command support
Add base Android emulator console avd command support and associated help
message.
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
-rw-r--r-- | android-commands.h | 11 | ||||
-rw-r--r-- | android-console.c | 30 | ||||
-rw-r--r-- | android-console.h | 2 |
3 files changed, 43 insertions, 0 deletions
diff --git a/android-commands.h b/android-commands.h index 4e093598f..e3f1a67ab 100644 --- a/android-commands.h +++ b/android-commands.h @@ -103,6 +103,10 @@ static mon_cmd_t android_event_cmds[] = { { NULL, NULL, }, }; +static mon_cmd_t android_avd_cmds[] = { + { NULL, NULL, }, +}; + static mon_cmd_t android_cmds[] = { { .name = "help|h|?", @@ -147,5 +151,12 @@ static mon_cmd_t android_cmds[] = { .mhandler.cmd = android_console_event, .sub_table = android_event_cmds, }, + { .name = "avd", + .args_type = "item:s?", + .params = "", + .help = "control virtual device execution", + .mhandler.cmd = android_console_avd, + .sub_table = android_avd_cmds, + }, { NULL, NULL, }, }; diff --git a/android-console.c b/android-console.c index e0a8fffc8..ab7ea1339 100644 --- a/android-console.c +++ b/android-console.c @@ -710,3 +710,33 @@ void android_console_event(Monitor *mon, const QDict *qdict) monitor_printf(mon, "%s\n%s\n", event_help[cmd], helptext ? "OK" : "KO: missing sub-command"); } + +enum { + CMD_AVD, +}; + +static const char *avd_help[] = { + /* CMD_AVD */ + "allows you to control (e.g. start/stop) the execution of the virtual " + "device\n" + "\n" + "available sub-commands:\n" + " avd stop stop the virtual device\n" + " avd start start/restart the virtual device\n" + " avd status query virtual device status\n" + " avd name query virtual device name\n" + " avd snapshot state snapshot commands\n", +}; + +void android_console_avd(Monitor *mon, const QDict *qdict) +{ + /* This only gets called for bad subcommands and help requests */ + const char *helptext = qdict_get_try_str(qdict, "helptext"); + + /* Default to the first entry which is the parent help message */ + int cmd = CMD_AVD; + + /* 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 4cb9ad4e6..67a1bf6e7 100644 --- a/android-console.h +++ b/android-console.h @@ -42,6 +42,8 @@ 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(Monitor *mon, const QDict *qdict); + void android_monitor_print_error(Monitor *mon, const char *fmt, ...); #endif |