aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Bellows <greg.bellows@linaro.org>2014-11-18 16:31:31 -0600
committerAlex Bennée <alex.bennee@linaro.org>2015-01-07 11:36:06 +0000
commit7a761f179f6964177e390a9001e600f40ed22994 (patch)
treeb59e6957e1f5ffc0f8f161f6e3a396cbdec41dbe
parent5850feb4b98add1d53a2fa01fa59d71f47fe7867 (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> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> [AJB: fixed up sub-table] Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
-rw-r--r--android-commands.h11
-rw-r--r--android-console.c30
-rw-r--r--android-console.h2
3 files changed, 43 insertions, 0 deletions
diff --git a/android-commands.h b/android-commands.h
index c8119effe..abd798a80 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_cmds.static_table = android_event_cmds,
},
+ { .name = "avd",
+ .args_type = "item:s?",
+ .params = "",
+ .help = "control virtual device execution",
+ .mhandler.cmd = android_console_avd,
+ .sub_cmds.static_table = android_avd_cmds,
+ },
{ NULL, NULL, },
};
diff --git a/android-console.c b/android-console.c
index f2f2ff227..8875824bf 100644
--- a/android-console.c
+++ b/android-console.c
@@ -726,3 +726,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