• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/core


コミットメタ情報

リビジョン59ec200272072a54e19fdb448a6e8f355f269bb6 (tree)
日時2016-09-12 05:53:41
作者Steve Kondik <steve@cyng...>
コミッターSteve Kondik

ログメッセージ

adb: Add wait-for-online command

  • Add the pseudo-state "online" which means either "device" or
    "recovery". This is used by our tooling.

Change-Id: I92034c477d28f847e24ec72bbb87b252fba875e1

変更サマリ

差分

--- a/adb/adb.h
+++ b/adb/adb.h
@@ -114,6 +114,7 @@ enum ConnectionState {
114114 kCsNoPerm, // Insufficient permissions to communicate with the device.
115115 kCsSideload,
116116 kCsUnauthorized,
117+ kCsOnline,
117118 };
118119
119120 /* A listener is an entity which binds to a local port
--- a/adb/commandline.cpp
+++ b/adb/commandline.cpp
@@ -209,7 +209,7 @@ static void help() {
209209 "scripting:\n"
210210 " adb wait-for[-<transport>]-<state>\n"
211211 " - wait for device to be in the given state:\n"
212- " device, recovery, sideload, or bootloader\n"
212+ " device, recovery, sideload, online, or bootloader\n"
213213 " Transport is: usb, local or any [default=any]\n"
214214 " adb start-server - ensure that there is a server running\n"
215215 " adb kill-server - kill the server if it is running\n"
@@ -1083,10 +1083,10 @@ static bool wait_for_device(const char* service, TransportType t, const char* se
10831083 }
10841084
10851085 if (components[3] != "any" && components[3] != "bootloader" && components[3] != "device" &&
1086- components[3] != "recovery" && components[3] != "sideload") {
1086+ components[3] != "recovery" && components[3] != "sideload" && components[3] != "online") {
10871087 fprintf(stderr,
10881088 "adb: unknown state %s; "
1089- "expected 'any', 'bootloader', 'device', 'recovery', or 'sideload'\n",
1089+ "expected 'any', 'bootloader', 'device', 'recovery', 'online', or 'sideload'\n",
10901090 components[3].c_str());
10911091 return false;
10921092 }
--- a/adb/services.cpp
+++ b/adb/services.cpp
@@ -391,7 +391,9 @@ static void wait_for_state(int fd, void* data) {
391391 std::string error = "unknown error";
392392 const char* serial = sinfo->serial.length() ? sinfo->serial.c_str() : NULL;
393393 atransport* t = acquire_one_transport(sinfo->transport_type, serial, &is_ambiguous, &error);
394- if (t != nullptr && (sinfo->state == kCsAny || sinfo->state == t->connection_state)) {
394+ if (t != nullptr && (sinfo->state == kCsAny || sinfo->state == t->connection_state ||
395+ (sinfo->state == kCsOnline && (t->connection_state == kCsRecovery ||
396+ t->connection_state == kCsDevice)) )) {
395397 SendOkay(fd);
396398 break;
397399 } else if (!is_ambiguous) {
@@ -557,6 +559,8 @@ asocket* host_service_to_socket(const char* name, const char* serial) {
557559 sinfo->state = kCsBootloader;
558560 } else if (!strcmp(name, "-any")) {
559561 sinfo->state = kCsAny;
562+ } else if (!strcmp(name, "-online")) {
563+ sinfo->state = kCsOnline;
560564 } else {
561565 return nullptr;
562566 }