Merge "adbd: properly handle FUNCTIONFS_BIND without ENABLE." am: 22ff8e1909
am: b90db0840a
Change-Id: Ia15a78ca5c818e820309e8ab75512e3dc5f48205
This commit is contained in:
commit
313d214ec0
1 changed files with 2 additions and 16 deletions
|
|
@ -270,29 +270,15 @@ struct UsbFfsConnection : public Connection {
|
||||||
bool started = false;
|
bool started = false;
|
||||||
bool running = true;
|
bool running = true;
|
||||||
while (running) {
|
while (running) {
|
||||||
int timeout = -1;
|
|
||||||
if (!bound || !started) {
|
|
||||||
timeout = 5000 /*ms*/;
|
|
||||||
}
|
|
||||||
|
|
||||||
adb_pollfd pfd[2] = {
|
adb_pollfd pfd[2] = {
|
||||||
{ .fd = control_fd_.get(), .events = POLLIN, .revents = 0 },
|
{ .fd = control_fd_.get(), .events = POLLIN, .revents = 0 },
|
||||||
{ .fd = monitor_event_fd_.get(), .events = POLLIN, .revents = 0 },
|
{ .fd = monitor_event_fd_.get(), .events = POLLIN, .revents = 0 },
|
||||||
};
|
};
|
||||||
int rc = TEMP_FAILURE_RETRY(adb_poll(pfd, 2, timeout));
|
int rc = TEMP_FAILURE_RETRY(adb_poll(pfd, 2, -1));
|
||||||
if (rc == -1) {
|
if (rc == -1) {
|
||||||
PLOG(FATAL) << "poll on USB control fd failed";
|
PLOG(FATAL) << "poll on USB control fd failed";
|
||||||
} else if (rc == 0) {
|
} else if (rc == 0) {
|
||||||
// Something in the kernel presumably went wrong.
|
LOG(FATAL) << "poll on USB control fd returned 0";
|
||||||
// Close our endpoints, wait for a bit, and then try again.
|
|
||||||
StopWorker();
|
|
||||||
aio_context_.reset();
|
|
||||||
read_fd_.reset();
|
|
||||||
write_fd_.reset();
|
|
||||||
control_fd_.reset();
|
|
||||||
std::this_thread::sleep_for(5s);
|
|
||||||
HandleError("didn't receive FUNCTIONFS_ENABLE, retrying");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pfd[1].revents) {
|
if (pfd[1].revents) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue