DO NOT MERGE cherry-pick "adb reboot" from master:
adb: add "adb reboot" command.
This will allow rebooting the device via adb on any build, including user builds.
An optional argument can be provided
(for example, "adb reboot bootloader" or adb reboot recovery")
Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/adb/commandline.c b/adb/commandline.c
index 548d362..5414e5e 100644
--- a/adb/commandline.c
+++ b/adb/commandline.c
@@ -147,6 +147,7 @@
" adb get-serialno - prints: <serial-number>\n"
" adb status-window - continuously print device status for a specified device\n"
" adb remount - remounts the /system partition on the device read-write\n"
+ " adb reboot [bootloader|recovery] - reboots the device, optionally into the bootloader or recovery program\n"
" adb root - restarts adb with root permissions\n"
"\n"
"networking:\n"
@@ -915,6 +916,22 @@
return 1;
}
+ if(!strcmp(argv[0], "reboot")) {
+ int fd;
+ if (argc > 1)
+ snprintf(buf, sizeof(buf), "reboot:%s", argv[1]);
+ else
+ snprintf(buf, sizeof(buf), "reboot:");
+ fd = adb_connect(buf);
+ if(fd >= 0) {
+ read_and_dump(fd);
+ adb_close(fd);
+ return 0;
+ }
+ fprintf(stderr,"error: %s\n", adb_error());
+ return 1;
+ }
+
if(!strcmp(argv[0], "root")) {
int fd = adb_connect("root:");
if(fd >= 0) {