OSDN Git Service

resolved conflicts for merge of 988d3d71 to honeycomb-plus-aosp
authorVladimir Chtchetkine <vchtchetkine@google.com>
Mon, 8 Aug 2011 21:47:04 +0000 (14:47 -0700)
committerVladimir Chtchetkine <vchtchetkine@google.com>
Mon, 8 Aug 2011 21:47:04 +0000 (14:47 -0700)
Change-Id: I85178afbca0b8b51eb3890958b063a70a1b33b96

reference-ril/reference-ril.c
rild/rild.c

index 02a7e12..ce2b0ce 100644 (file)
@@ -35,6 +35,7 @@
 #include <sys/system_properties.h>
 
 #include "ril.h"
+#include "hardware/qemu_pipe.h"
 
 #define LOG_TAG "RIL"
 #include <utils/Log.h>
@@ -2072,21 +2073,28 @@ mainLoop(void *param)
                 fd = socket_loopback_client(s_port, SOCK_STREAM);
             } else if (s_device_socket) {
                 if (!strcmp(s_device_path, "/dev/socket/qemud")) {
-                    /* Qemu-specific control socket */
-                    fd = socket_local_client( "qemud",
-                                              ANDROID_SOCKET_NAMESPACE_RESERVED,
-                                              SOCK_STREAM );
-                    if (fd >= 0 ) {
-                        char  answer[2];
-
-                        if ( write(fd, "gsm", 3) != 3 ||
-                             read(fd, answer, 2) != 2 ||
-                             memcmp(answer, "OK", 2) != 0)
-                        {
-                            close(fd);
-                            fd = -1;
-                        }
-                   }
+                    /* Before trying to connect to /dev/socket/qemud (which is
+                     * now another "legacy" way of communicating with the
+                     * emulator), we will try to connecto to gsm service via
+                     * qemu pipe. */
+                    fd = qemu_pipe_open("qemud:gsm");
+                    if (fd < 0) {
+                        /* Qemu-specific control socket */
+                        fd = socket_local_client( "qemud",
+                                                  ANDROID_SOCKET_NAMESPACE_RESERVED,
+                                                  SOCK_STREAM );
+                        if (fd >= 0 ) {
+                            char  answer[2];
+
+                            if ( write(fd, "gsm", 3) != 3 ||
+                                 read(fd, answer, 2) != 2 ||
+                                 memcmp(answer, "OK", 2) != 0)
+                            {
+                                close(fd);
+                                fd = -1;
+                            }
+                       }
+                    }
                 }
                 else
                     fd = socket_local_client( s_device_path,
index 8ee3569..18ff671 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/prctl.h>
 
 #include <private/android_filesystem_config.h>
+#include "hardware/qemu_pipe.h"
 
 #define LIB_PATH_PROPERTY   "rild.libpath"
 #define LIB_ARGS_PROPERTY   "rild.libargs"
@@ -175,11 +176,13 @@ int main(int argc, char **argv)
 
                 sleep(1);
 
-                fd = socket_local_client(
-                            QEMUD_SOCKET_NAME,
-                            ANDROID_SOCKET_NAMESPACE_RESERVED,
-                            SOCK_STREAM );
-
+                fd = qemu_pipe_open("qemud:gsm");
+                if (fd < 0) {
+                    fd = socket_local_client(
+                                QEMUD_SOCKET_NAME,
+                                ANDROID_SOCKET_NAMESPACE_RESERVED,
+                                SOCK_STREAM );
+                }
                 if (fd >= 0) {
                     close(fd);
                     snprintf( arg_device, sizeof(arg_device), "%s/%s",