Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
scorpio
hardware_libhardware
Commits
079ff13b
Commit
079ff13b
authored
13 years ago
by
Vladimir Chtchetkine
Committed by
Android Code Review
13 years ago
Browse files
Options
Download
Plain Diff
Merge "Enable connection to QEMUD via pipe."
parents
4306ca7d
39e2630d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
25 deletions
+32
-25
include/hardware/qemu_pipe.h
include/hardware/qemu_pipe.h
+0
-2
include/hardware/qemud.h
include/hardware/qemud.h
+32
-23
No files found.
include/hardware/qemu_pipe.h
View file @
079ff13b
...
...
@@ -20,8 +20,6 @@
#include <unistd.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <hardware/qemud.h>
#include <hardware/qemu_pipe.h>
#include <pthread.h>
/* for pthread_once() */
#include <stdlib.h>
#include <stdio.h>
...
...
This diff is collapsed.
Click to expand it.
include/hardware/qemud.h
View file @
079ff13b
...
...
@@ -18,10 +18,12 @@
#define ANDROID_INCLUDE_HARDWARE_QEMUD_H
#include <cutils/sockets.h>
#include "qemu_pipe.h"
/* the following is helper code that is used by the QEMU-specific
* 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
* development/emulator/qemud/qemud.c
...
...
@@ -64,30 +66,37 @@ qemud_channel_open(const char* name)
int
fd
;
int
namelen
=
strlen
(
name
);
char
answer
[
2
];
char
pipe_name
[
256
];
/* connect to qemud control socket */
fd
=
socket_local_client
(
"qemud"
,
ANDROID_SOCKET_NAMESPACE_RESERVED
,
SOCK_STREAM
);
/* 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
(
"no qemud control socket: %s"
,
strerror
(
errno
));
return
-
1
;
}
/* send service name to connect */
if
(
qemud_fd_write
(
fd
,
name
,
namelen
)
!=
namelen
)
{
D
(
"can't send service name to qemud: %s"
,
strerror
(
errno
));
close
(
fd
);
return
-
1
;
}
/* read answer from daemon */
if
(
qemud_fd_read
(
fd
,
answer
,
2
)
!=
2
||
answer
[
0
]
!=
'O'
||
answer
[
1
]
!=
'K'
)
{
D
(
"cant' connect to %s service through qemud"
,
name
);
close
(
fd
);
return
-
1
;
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"
,
ANDROID_SOCKET_NAMESPACE_RESERVED
,
SOCK_STREAM
);
if
(
fd
<
0
)
{
D
(
"no qemud control socket: %s"
,
strerror
(
errno
));
return
-
1
;
}
/* send service name to connect */
if
(
qemud_fd_write
(
fd
,
name
,
namelen
)
!=
namelen
)
{
D
(
"can't send service name to qemud: %s"
,
strerror
(
errno
));
close
(
fd
);
return
-
1
;
}
/* read answer from daemon */
if
(
qemud_fd_read
(
fd
,
answer
,
2
)
!=
2
||
answer
[
0
]
!=
'O'
||
answer
[
1
]
!=
'K'
)
{
D
(
"cant' connect to %s service through qemud"
,
name
);
close
(
fd
);
return
-
1
;
}
}
return
fd
;
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment