diff options
author | Greg Bellows <greg.bellows@linaro.org> | 2014-11-17 14:01:18 -0600 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2015-01-07 11:36:06 +0000 |
commit | e5b922e29d308f2a4fee9b29e3f59714a53a83b0 (patch) | |
tree | a41bb00da86380bc332d06274887788c84dba012 | |
parent | 0ddfe0d12990d4ec6306cae1297cce2ca11e1542 (diff) | |
download | qemu-android-e5b922e29d308f2a4fee9b29e3f59714a53a83b0.tar.gz |
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.h | 7 | ||||
-rw-r--r-- | android-console.c | 23 | ||||
-rw-r--r-- | android-console.h | 1 |
3 files changed, 30 insertions, 1 deletions
diff --git a/android-commands.h b/android-commands.h index 4172feebab..c8119effe7 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 db7c16a751..f2f2ff227f 100644 --- a/android-console.c +++ b/android-console.c @@ -534,6 +534,7 @@ enum { CMD_EVENT_TYPES, CMD_EVENT_CODES, CMD_EVENT_SEND, + CMD_EVENT_TEXT, }; static const char *event_help[] = { @@ -554,7 +555,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) @@ -683,6 +689,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 */ @@ -698,6 +717,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 b69feecc09..4cb9ad4e6e 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, ...); |