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-11-19 17:08:01 -0600
commit30ac80cbebe755aedea45f7ab2b16cc08c390317 (patch)
treeb1194ed371f3dd1666d786659cb11c4a3bb72ccb
parent3f5eaa428b46b5c9491ae6faa611545358f17e60 (diff)
android-console: Add event text command stub
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, ...);