aboutsummaryrefslogtreecommitdiffstats
path: root/android
diff options
context:
space:
mode:
authorVladimir Chtchetkine <vchtchetkine@google.com>2012-03-15 10:38:16 -0700
committerVladimir Chtchetkine <vchtchetkine@google.com>2012-03-15 10:38:16 -0700
commit46ff3eaff40952df50ee14056cae88a3e7396a81 (patch)
tree630927bc2240e2ff5a3d0e5839e5be042e55f995 /android
parenta89252fb1e98161e9c5d4c1506eddda7dc93e6f8 (diff)
downloadexternal_qemu-46ff3eaff40952df50ee14056cae88a3e7396a81.zip
external_qemu-46ff3eaff40952df50ee14056cae88a3e7396a81.tar.gz
external_qemu-46ff3eaff40952df50ee14056cae88a3e7396a81.tar.bz2
Fix emulator crash on sensor emulation.
The reason for crash is that event socket's I/O looper has been used without being properly initialized. Change-Id: I4f6372a4c2e54d5ea80313eda5208da17fc84d1d
Diffstat (limited to 'android')
-rw-r--r--android/android-device.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/android/android-device.c b/android/android-device.c
index 498e304..e91185d 100644
--- a/android/android-device.c
+++ b/android/android-device.c
@@ -389,6 +389,14 @@ _android_dev_socket_destroy(AndroidDevSocket* ads)
memset(&ads->address, 0, sizeof(ads->address));
}
+/* Event socket's asynchronous I/O looper callback.
+ * Param:
+ * opaque - AndroidEventSocket instance.
+ * fd - Socket's FD.
+ * events - I/O type bitsmask (read | write).
+ */
+static void _on_event_socket_io(void* opaque, int fd, unsigned events);
+
static int
_android_dev_socket_connect(AndroidDevSocket* ads)
{
@@ -403,6 +411,14 @@ _android_dev_socket_connect(AndroidDevSocket* ads)
}
socket_set_nonblock(ads->fd);
+ /* XXX: A quick fix for event channel init. Redo this later. */
+ if (ads->type == ADS_TYPE_EVENT) {
+ AndroidEventSocket* adsevent = (AndroidEventSocket*)ads;
+ /* Prepare for async I/O on the event socket. */
+ loopIo_init(adsevent->io, adsevent->dev_socket.ad->looper, ads->fd,
+ _on_event_socket_io, adsevent);
+ }
+
/* Synchronously connect to it. */
ads->socket_status = ADS_CONNECTING;
iolooper_add_write(_ads_io_looper(ads), ads->fd);
@@ -952,11 +968,14 @@ _android_event_socket_connect_sync(AndroidEventSocket* adsevent)
{
AndroidDevSocket* ads = &adsevent->dev_socket;
const int res = _android_dev_socket_connect(&adsevent->dev_socket);
+ /* XXX: This is patch-fixed in _android_dev_socket_connect */
+#if 0
if (res == 0) {
/* Prepare for async I/O on the event socket. */
loopIo_init(adsevent->io, _aes_looper(adsevent), ads->fd,
_on_event_socket_io, adsevent);
}
+#endif
return res;
}
@@ -1208,6 +1227,7 @@ _on_event_socket_connected(AndroidEventSocket* adsevent, int failure)
/* Complete event socket connection by identifying it as "event" socket with
* the application. */
+ ads->socket_status = ADS_CONNECTED;
res = _android_dev_socket_register(ads);
if (res) {