diff options
Diffstat (limited to 'minadbd')
-rw-r--r-- | minadbd/minadbd.cpp | 12 | ||||
-rw-r--r-- | minadbd/minadbd_services.cpp | 6 | ||||
-rw-r--r-- | minadbd/minadbd_services.h | 2 |
3 files changed, 18 insertions, 2 deletions
diff --git a/minadbd/minadbd.cpp b/minadbd/minadbd.cpp index 57158ad57..c80d5490a 100644 --- a/minadbd/minadbd.cpp +++ b/minadbd/minadbd.cpp @@ -31,10 +31,13 @@ #include "minadbd_services.h" #include "minadbd_types.h" +using namespace std::string_literals; + int main(int argc, char** argv) { android::base::InitLogging(argv, &android::base::StderrLogger); // TODO(xunchang) implement a command parser - if (argc != 3 || strcmp("--socket_fd", argv[1]) != 0) { + if ((argc != 3 && argc != 4) || argv[1] != "--socket_fd"s || + (argc == 4 && argv[3] != "--rescue"s)) { LOG(ERROR) << "minadbd has invalid arguments, argc: " << argc; exit(kMinadbdArgumentsParsingError); } @@ -50,7 +53,12 @@ int main(int argc, char** argv) { } SetMinadbdSocketFd(socket_fd); - adb_device_banner = "sideload"; + if (argc == 4) { + SetMinadbdRescueMode(true); + adb_device_banner = "rescue"; + } else { + adb_device_banner = "sideload"; + } signal(SIGPIPE, SIG_IGN); diff --git a/minadbd/minadbd_services.cpp b/minadbd/minadbd_services.cpp index 79e6fc4e0..f0bb70af1 100644 --- a/minadbd/minadbd_services.cpp +++ b/minadbd/minadbd_services.cpp @@ -45,10 +45,16 @@ #include "sysdeps.h" static int minadbd_socket = -1; +static bool rescue_mode = false; + void SetMinadbdSocketFd(int socket_fd) { minadbd_socket = socket_fd; } +void SetMinadbdRescueMode(bool rescue) { + rescue_mode = rescue; +} + static bool WriteCommandToFd(MinadbdCommands cmd, int fd) { char message[kMinadbdMessageSize]; memcpy(message, kMinadbdCommandPrefix, strlen(kMinadbdStatusPrefix)); diff --git a/minadbd/minadbd_services.h b/minadbd/minadbd_services.h index 6835bd770..20e3410c0 100644 --- a/minadbd/minadbd_services.h +++ b/minadbd/minadbd_services.h @@ -17,3 +17,5 @@ #pragma once void SetMinadbdSocketFd(int socket_fd); + +void SetMinadbdRescueMode(bool); |