aboutsummaryrefslogtreecommitdiffstats
path: root/android/console.c
diff options
context:
space:
mode:
authorVladimir Chtchetkine <vchtchetkine@google.com>2011-01-19 18:29:27 -0800
committerVladimir Chtchetkine <vchtchetkine@google.com>2011-01-19 18:29:27 -0800
commit9411a562e1ab772732a4d5147c9103a638837c82 (patch)
treebf11eddce29c02b4376bc0cb76e5f9233791cf39 /android/console.c
parenta9edc435e6592fcc001e21e150391a84bde114a6 (diff)
downloadexternal_qemu-9411a562e1ab772732a4d5147c9103a638837c82.zip
external_qemu-9411a562e1ab772732a4d5147c9103a638837c82.tar.gz
external_qemu-9411a562e1ab772732a4d5147c9103a638837c82.tar.bz2
Implement user event transmission between the UI and the core
Change-Id: I503aa691cada5250b76167a923d4a226d20ee41d
Diffstat (limited to 'android/console.c')
-rw-r--r--android/console.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/android/console.c b/android/console.c
index 96cc005..6f9e26b 100644
--- a/android/console.c
+++ b/android/console.c
@@ -53,6 +53,7 @@
#include "android/core-ui-protocol.h"
#include "android/display-core.h"
#include "android/framebuffer-core.h"
+#include "android/user-events-core.h"
#if defined(CONFIG_SLIRP)
#include "libslirp.h"
@@ -119,6 +120,12 @@ ControlClient attached_ui_client = NULL;
/* Core framebuffer service client. */
ControlClient framebuffer_client = NULL;
+
+/* User events service client. */
+ControlClient user_events_client = NULL;
+
+/* User events service. */
+CoreUserEvents* core_ue = NULL;
#endif // CONFIG_STANDALONE_CORE
/* -android-avdname option value. Defined in vl-android.c */
@@ -236,6 +243,11 @@ control_client_destroy( ControlClient client )
}
framebuffer_client = NULL;
}
+
+ if (client == user_events_client) {
+ coreue_destroy(core_ue);
+ user_events_client = NULL;
+ }
#endif // CONFIG_STANDALONE_CORE
sock = control_client_detach( client );
@@ -2537,6 +2549,32 @@ do_create_framebuffer_service( ControlClient client, char* args )
return 0;
}
+
+static int
+do_create_user_events_service( ControlClient client, char* args )
+{
+ // Make sure that there are no framebuffer client already existing.
+ if (user_events_client != NULL) {
+ control_write( client, "KO: Another user events service is already existing!\r\n" );
+ control_client_destroy(client);
+ return -1;
+ }
+
+ core_ue = coreue_create(client->sock);
+ if (core_ue != NULL) {
+ char reply_buf[4096];
+ user_events_client = client;
+ // Reply "OK" with the framebuffer's bits per pixel
+ snprintf(reply_buf, sizeof(reply_buf), "OK\r\n");
+ control_write( client, reply_buf);
+ } else {
+ control_write( client, "KO\r\n" );
+ control_client_destroy(client);
+ return -1;
+ }
+
+ return 0;
+}
#endif // CONFIG_STANDALONE_CORE
static const CommandDefRec qemu_commands[] =
@@ -2553,6 +2591,10 @@ static const CommandDefRec qemu_commands[] =
{ "framebuffer", "create framebuffer service",
"Create framebuffer service\r\n",
NULL, do_create_framebuffer_service, NULL },
+
+ { "user events", "create user events service",
+ "Create user events service\r\n",
+ NULL, do_create_user_events_service, NULL },
#endif // CONFIG_STANDALONE_CORE
{ NULL, NULL, NULL, NULL, NULL, NULL }