* commit '74b6e8ecfdb4e7f46d53f174e8ba21ce74f90482': adb: `features` passes transport features.
This commit is contained in:
commit
04aa49346a
2 changed files with 22 additions and 4 deletions
24
adb/adb.cpp
24
adb/adb.cpp
|
@ -1133,9 +1133,27 @@ int handle_host_request(const char* service, TransportType type,
|
|||
}
|
||||
|
||||
if (!strcmp(service, "features")) {
|
||||
SendOkay(reply_fd);
|
||||
SendProtocolString(
|
||||
reply_fd, android::base::Join(supported_features(), '\n'));
|
||||
std::string error_msg;
|
||||
atransport* t = acquire_one_transport(kCsAny, type, serial, &error_msg);
|
||||
if (t != nullptr) {
|
||||
SendOkay(reply_fd, android::base::Join(t->features(), '\n'));
|
||||
} else {
|
||||
SendFail(reply_fd, error_msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!strncmp(service, "check-feature:", strlen("check-feature:"))) {
|
||||
std::string error_msg;
|
||||
atransport* t = acquire_one_transport(kCsAny, type, serial, &error_msg);
|
||||
if (t && t->CanUseFeature(service + strlen("check-feature:"))) {
|
||||
// We could potentially extend this to reply with the feature
|
||||
// version if that becomes necessary.
|
||||
SendOkay(reply_fd, "1");
|
||||
} else {
|
||||
// Empty response means unsupported feature.
|
||||
SendOkay(reply_fd, "");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1452,7 +1452,7 @@ int adb_commandline(int argc, const char **argv) {
|
|||
return 0;
|
||||
}
|
||||
else if (!strcmp(argv[0], "features")) {
|
||||
return adb_query_command("host:features");
|
||||
return adb_query_command(format_host_command("features", transport_type, serial));
|
||||
}
|
||||
|
||||
usage();
|
||||
|
|
Loading…
Reference in a new issue