adbd: respond to device-to-host control transfers.

Failing to write to the endpoint results in subsequent reads on ep0 to
fail with EL2HLT, so do an empty write to fulfill the transfer.

Bug: http://b/131867920
Test: manually tested with modified auto client
Change-Id: If2eec162ca4b31a9974c7bd5802be51cee9e2708
Merged-In: If2eec162ca4b31a9974c7bd5802be51cee9e2708
(cherry-picked from internal commit af086e9a95)
This commit is contained in:
Josh Gao 2019-05-21 16:07:03 -07:00
parent fc2e2003dd
commit 43a0a9a5bf
1 changed files with 6 additions and 1 deletions

View File

@ -380,7 +380,12 @@ struct UsbFfsConnection : public Connection {
<< ", wLength = " << static_cast<int>(event.u.setup.wLength);
if ((event.u.setup.bRequestType & USB_DIR_IN)) {
LOG(WARNING) << "received a device-to-host control transfer, ignoring";
LOG(INFO) << "acking device-to-host control transfer";
ssize_t rc = adb_write(control_fd_.get(), "", 0);
if (rc != 0) {
PLOG(ERROR) << "failed to write empty packet to host";
break;
}
} else {
std::string buf;
buf.resize(event.u.setup.wLength + 1);