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

Commit 3441f232 authored by Josh Gao's avatar Josh Gao
Browse files

adb: add `adb transport-id` command.

Make it possible to safely script waiting for a device to go away after
root/unroot.

Test: manual
Change-Id: I652560ad1d88a5c6a1e8ea5787c3cf165c82aa63
parent a5fa1ae8
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -1712,14 +1712,21 @@ int adb_commandline(int argc, const char** argv) {
        }
        printf("List of devices attached\n");
        return adb_query_command(query);
    } else if (!strcmp(argv[0], "transport-id")) {
        TransportId transport_id;
        std::string error;
        unique_fd fd(adb_connect(&transport_id, "host:features", &error, true));
        if (fd == -1) {
            error_exit("%s", error.c_str());
        }
    else if (!strcmp(argv[0], "connect")) {
        printf("%" PRIu64 "\n", transport_id);
        return 0;
    } else if (!strcmp(argv[0], "connect")) {
        if (argc != 2) error_exit("usage: adb connect HOST[:PORT]");

        std::string query = android::base::StringPrintf("host:connect:%s", argv[1]);
        return adb_query_command(query);
    }
    else if (!strcmp(argv[0], "disconnect")) {
    } else if (!strcmp(argv[0], "disconnect")) {
        if (argc > 2) error_exit("usage: adb disconnect [HOST[:PORT]]");

        std::string query = android::base::StringPrintf("host:disconnect:%s",