Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a06225bf authored by Josh Gao's avatar Josh Gao Committed by android-build-merger
Browse files

Merge "adb: add `adb host-features`, report libusb status." am: 311de0ac

am: 98ee7349

Change-Id: I43ce6513d1615fe9841f166e0963411aabba8ec9
parents 6aaa953d 98ee7349
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1129,6 +1129,18 @@ int handle_host_request(const char* service, TransportType type,
        return 0;
    }

#if ADB_HOST
    if (!strcmp(service, "host-features")) {
        FeatureSet features = supported_features();
        // Abuse features to report libusb status.
        if (should_use_libusb()) {
            features.insert(kFeatureLibusb);
        }
        SendOkay(reply_fd, FeatureSetToString(features));
        return 0;
    }
#endif

    // remove TCP transport
    if (!strncmp(service, "disconnect:", 11)) {
        const std::string address(service + 11);
+1 −1
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ constexpr size_t LINUX_MAX_SOCKET_SIZE = 4194304;
std::string adb_version();

// Increment this when we want to force users to start a new adb server.
#define ADB_SERVER_VERSION 38
#define ADB_SERVER_VERSION 39

class atransport;

+0 −5
Original line number Diff line number Diff line
@@ -17,11 +17,6 @@
#include <android-base/logging.h>
#include "usb.h"

static bool should_use_libusb() {
    static bool enable = getenv("ADB_LIBUSB") && strcmp(getenv("ADB_LIBUSB"), "1") == 0;
    return enable;
}

void usb_init() {
    if (should_use_libusb()) {
        LOG(DEBUG) << "using libusb backend";
+3 −2
Original line number Diff line number Diff line
@@ -1929,8 +1929,7 @@ int adb_commandline(int argc, const char** argv) {
    else if (!strcmp(argv[0], "--version") || !strcmp(argv[0], "version")) {
        fprintf(stdout, "%s", adb_version().c_str());
        return 0;
    }
    else if (!strcmp(argv[0], "features")) {
    } else if (!strcmp(argv[0], "features")) {
        // Only list the features common to both the adb client and the device.
        FeatureSet features;
        std::string error;
@@ -1945,6 +1944,8 @@ int adb_commandline(int argc, const char** argv) {
            }
        }
        return 0;
    } else if (!strcmp(argv[0], "host-features")) {
        return adb_query_command("host:host-features");
    } else if (!strcmp(argv[0], "reconnect")) {
        if (argc == 1) {
            return adb_query_command("host:reconnect");
+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ static std::mutex& transport_lock = *new std::mutex();
const char* const kFeatureShell2 = "shell_v2";
const char* const kFeatureCmd = "cmd";
const char* const kFeatureStat2 = "stat_v2";
const char* const kFeatureLibusb = "libusb";

static std::string dump_packet(const char* name, const char* func, apacket* p) {
    unsigned command = p->msg.command;
Loading