Merge "Enable connection to QEMUD via pipe."
This commit is contained in:
commit
079ff13b07
2 changed files with 30 additions and 23 deletions
|
@ -20,8 +20,6 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <hardware/qemud.h>
|
|
||||||
#include <hardware/qemu_pipe.h>
|
|
||||||
#include <pthread.h> /* for pthread_once() */
|
#include <pthread.h> /* for pthread_once() */
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -18,10 +18,12 @@
|
||||||
#define ANDROID_INCLUDE_HARDWARE_QEMUD_H
|
#define ANDROID_INCLUDE_HARDWARE_QEMUD_H
|
||||||
|
|
||||||
#include <cutils/sockets.h>
|
#include <cutils/sockets.h>
|
||||||
|
#include "qemu_pipe.h"
|
||||||
|
|
||||||
/* the following is helper code that is used by the QEMU-specific
|
/* the following is helper code that is used by the QEMU-specific
|
||||||
* hardware HAL modules to communicate with the emulator program
|
* hardware HAL modules to communicate with the emulator program
|
||||||
* through the 'qemud' multiplexing daemon.
|
* through the 'qemud' multiplexing daemon, or through the qemud
|
||||||
|
* pipe.
|
||||||
*
|
*
|
||||||
* see the documentation comments for details in
|
* see the documentation comments for details in
|
||||||
* development/emulator/qemud/qemud.c
|
* development/emulator/qemud/qemud.c
|
||||||
|
@ -64,8 +66,14 @@ qemud_channel_open(const char* name)
|
||||||
int fd;
|
int fd;
|
||||||
int namelen = strlen(name);
|
int namelen = strlen(name);
|
||||||
char answer[2];
|
char answer[2];
|
||||||
|
char pipe_name[256];
|
||||||
|
|
||||||
/* connect to qemud control socket */
|
/* First, try to connect to the pipe. */
|
||||||
|
snprintf(pipe_name, sizeof(pipe_name), "qemud:%s", name);
|
||||||
|
fd = qemu_pipe_open(pipe_name);
|
||||||
|
if (fd < 0) {
|
||||||
|
D("QEMUD pipe is not available for %s: %s", name, strerror(errno));
|
||||||
|
/* If pipe is not available, connect to qemud control socket */
|
||||||
fd = socket_local_client( "qemud",
|
fd = socket_local_client( "qemud",
|
||||||
ANDROID_SOCKET_NAMESPACE_RESERVED,
|
ANDROID_SOCKET_NAMESPACE_RESERVED,
|
||||||
SOCK_STREAM );
|
SOCK_STREAM );
|
||||||
|
@ -89,6 +97,7 @@ qemud_channel_open(const char* name)
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue