auto import from //branches/cupcake_rel/...@140373
diff --git a/reference-ril/reference-ril.c b/reference-ril/reference-ril.c
index ccb5b62..e2c9829 100644
--- a/reference-ril/reference-ril.c
+++ b/reference-ril/reference-ril.c
@@ -1913,9 +1913,27 @@
if (s_port > 0) {
fd = socket_loopback_client(s_port, SOCK_STREAM);
} else if (s_device_socket) {
- fd = socket_local_client( s_device_path,
- ANDROID_SOCKET_NAMESPACE_FILESYSTEM,
- SOCK_STREAM );
+ 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;
+ }
+ }
+ }
+ else
+ fd = socket_local_client( s_device_path,
+ ANDROID_SOCKET_NAMESPACE_FILESYSTEM,
+ SOCK_STREAM );
} else if (s_device_path != NULL) {
fd = open (s_device_path, O_RDWR);
if ( fd >= 0 && !memcmp( s_device_path, "/dev/ttyS", 9 ) ) {
diff --git a/rild/rild.c b/rild/rild.c
index 5b62501..14a6ea9 100644
--- a/rild/rild.c
+++ b/rild/rild.c
@@ -167,7 +167,7 @@
* give it some time to create its GSM socket
*/
int tries = 5;
-#define QEMUD_SOCKET_NAME "qemud_gsm"
+#define QEMUD_SOCKET_NAME "qemud"
while (1) {
int fd;