summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Bellows <greg.bellows@linaro.org>2014-11-17 14:01:18 -0600
committerGreg Bellows <greg.bellows@linaro.org>2014-12-02 10:04:26 -0600
commite75a69975cfb027a9ea2ca0d64b6195f27dcc664 (patch)
tree83092e2929787a946b78ac14055b770476d29111
parent0212f776726a045e99823b6e65cc7d14d804dc2a (diff)
android-console: Add event text command stubcons.mon.event
Add Android emulator console "event text" command function stub and help support. The command properly displays help text, but returns a "Not supported" message when executed due to limitations in texting telephony support. Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
-rw-r--r--android-commands.h7
-rw-r--r--android-console.c23
-rw-r--r--android-console.h1
3 files changed, 30 insertions, 1 deletions
diff --git a/android-commands.h b/android-commands.h
index 30ba9e64f..4e093598f 100644
--- a/android-commands.h
+++ b/android-commands.h
@@ -93,6 +93,13 @@ static mon_cmd_t android_event_cmds[] = {
.help = "send a series of events to the kernel",
.mhandler.cmd = android_console_event_send,
},
+ {
+ .name = "text",
+ .args_type = "arg:S?",
+ .params = "",
+ .help = "simulate keystrokes from a given text",
+ .mhandler.cmd = android_console_event_text,
+ },
{ NULL, NULL, },
};
diff --git a/android-console.c b/android-console.c
index 5eabd9e24..e0a8fffc8 100644
--- a/android-console.c
+++ b/android-console.c
@@ -518,6 +518,7 @@ enum {
CMD_EVENT_TYPES,
CMD_EVENT_CODES,
CMD_EVENT_SEND,
+ CMD_EVENT_TEXT,
};
static const char *event_help[] = {
@@ -538,7 +539,12 @@ static const char *event_help[] = {
/* CMD_EVENT_SEND */
"'event send <type>:<code>:<value> ...' allows your to send one or "
"more hardware events\nto the Android kernel. you can use text names "
- "or integers for <type> and <code>"
+ "or integers for <type> and <code>",
+ /* CMD_EVENT_TEXT */
+ "'event text <message>' allows you to simulate keypresses to generate "
+ "a given text\nmessage. <message> must be an utf-8 string. Unicode "
+ "points will be reverse-mapped\naccording to the current device "
+ "keyboard. unsupported characters will be discarded\nsilently",
};
void android_console_event_types(Monitor *mon, const QDict *qdict)
@@ -667,6 +673,19 @@ out:
g_strfreev(substr);
}
+void android_console_event_text(Monitor *mon, const QDict *qdict)
+{
+ const char *arg = qdict_get_try_str(qdict, "arg");
+
+ if (!arg) {
+ monitor_printf(mon,
+ "KO: argument missing, try 'event text <message>'\n");
+ return;
+ }
+
+ monitor_printf(mon, "KO: 'event text' is currently unsupported\n");
+}
+
void android_console_event(Monitor *mon, const QDict *qdict)
{
/* This only gets called for bad subcommands and help requests */
@@ -682,6 +701,8 @@ void android_console_event(Monitor *mon, const QDict *qdict)
cmd = CMD_EVENT_CODES;
} else if (strstr(helptext, "send")) {
cmd = CMD_EVENT_SEND;
+ } else if (strstr(helptext, "text")) {
+ cmd = CMD_EVENT_TEXT;
}
}
diff --git a/android-console.h b/android-console.h
index b69feecc0..4cb9ad4e6 100644
--- a/android-console.h
+++ b/android-console.h
@@ -39,6 +39,7 @@ void android_console_power(Monitor *mon, const QDict *qdict);
void android_console_event_types(Monitor *mon, const QDict *qdict);
void android_console_event_codes(Monitor *mon, const QDict *qdict);
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_monitor_print_error(Monitor *mon, const char *fmt, ...);