summaryrefslogtreecommitdiffstats
path: root/minadbd/minadbd.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2019-04-16 23:22:25 +0200
committerTao Bao <tbao@google.com>2019-04-17 23:07:23 +0200
commitc6dc325e88a25201aa3856e6532c3ed14203a376 (patch)
treea5a2cf98f7b31abbfa6116be2037634a1925b88f /minadbd/minadbd.cpp
parentMerge "Move load & restore logs to logging.cpp" (diff)
downloadandroid_bootable_recovery-c6dc325e88a25201aa3856e6532c3ed14203a376.tar
android_bootable_recovery-c6dc325e88a25201aa3856e6532c3ed14203a376.tar.gz
android_bootable_recovery-c6dc325e88a25201aa3856e6532c3ed14203a376.tar.bz2
android_bootable_recovery-c6dc325e88a25201aa3856e6532c3ed14203a376.tar.lz
android_bootable_recovery-c6dc325e88a25201aa3856e6532c3ed14203a376.tar.xz
android_bootable_recovery-c6dc325e88a25201aa3856e6532c3ed14203a376.tar.zst
android_bootable_recovery-c6dc325e88a25201aa3856e6532c3ed14203a376.zip
Diffstat (limited to 'minadbd/minadbd.cpp')
-rw-r--r--minadbd/minadbd.cpp12
1 files changed, 10 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);