diff options
author | Ethan Yonker <dees_troy@teamw.in> | 2014-11-08 00:19:07 +0100 |
---|---|---|
committer | Ethan Yonker <dees_troy@teamw.in> | 2014-11-08 00:25:46 +0100 |
commit | 24813426b9cf6d4a79e5da68008d1a4532e6c710 (patch) | |
tree | a7acec7a7c25379eed6caa207e008ec6029afdb5 /adb_install.cpp | |
parent | Fix zip install (diff) | |
download | android_bootable_recovery-24813426b9cf6d4a79e5da68008d1a4532e6c710.tar android_bootable_recovery-24813426b9cf6d4a79e5da68008d1a4532e6c710.tar.gz android_bootable_recovery-24813426b9cf6d4a79e5da68008d1a4532e6c710.tar.bz2 android_bootable_recovery-24813426b9cf6d4a79e5da68008d1a4532e6c710.tar.lz android_bootable_recovery-24813426b9cf6d4a79e5da68008d1a4532e6c710.tar.xz android_bootable_recovery-24813426b9cf6d4a79e5da68008d1a4532e6c710.tar.zst android_bootable_recovery-24813426b9cf6d4a79e5da68008d1a4532e6c710.zip |
Diffstat (limited to 'adb_install.cpp')
-rw-r--r-- | adb_install.cpp | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/adb_install.cpp b/adb_install.cpp index c731d1cd2..77b9a8c1c 100644 --- a/adb_install.cpp +++ b/adb_install.cpp @@ -36,7 +36,7 @@ extern "C" { static RecoveryUI* ui = NULL; -static void +void set_usb_driver(bool enabled) { int fd = open("/sys/class/android_usb/android0/enable", O_WRONLY); if (fd < 0) { @@ -68,7 +68,7 @@ stop_adbd() { } -static void +void maybe_restart_adbd() { char value[PROPERTY_VALUE_MAX+1]; int len = property_get("ro.debuggable", value, NULL); @@ -128,12 +128,14 @@ apply_from_adb(const char* install_file) { break; } } - printf("FIX ME: need to make adb sideload actually install the file!\n"); - //result = install_package(FUSE_SIDELOAD_HOST_PATHNAME, wipe_cache, install_file, false); + property_set("tw_sideload_file", FUSE_SIDELOAD_HOST_PATHNAME); + // Install is handled elsewhere in TWRP + result = 5; //install_package(FUSE_SIDELOAD_HOST_PATHNAME, wipe_cache, install_file, false); break; } - if (!waited) { + // We do this elsewhere in TWRP + /*if (!waited) { // Calling stat() on this magic filename signals the minadbd // subprocess to shut down. stat(FUSE_SIDELOAD_HOST_EXIT_PATHNAME, &st); @@ -143,25 +145,26 @@ apply_from_adb(const char* install_file) { // you just have to 'adb sideload' a file that's not a valid // package, like "/dev/null". waitpid(child, &status, 0); - } + }*/ - if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { - if (WEXITSTATUS(status) == 3) { - printf("\nYou need adb 1.0.32 or newer to sideload\nto this device.\n\n"); - } else if (!WIFSIGNALED(status)) { - printf("status %d\n", WEXITSTATUS(status)); - } - } - set_usb_driver(false); - maybe_restart_adbd(); - - if (stat(install_file, &st) != 0) { - if (errno == ENOENT) { - printf("No package received.\n"); - } else { - printf("Error reading package:\n %s\n", strerror(errno)); + if (result != 5) { + stat(FUSE_SIDELOAD_HOST_EXIT_PATHNAME, &st); + waitpid(child, &status, 0); + result = -1; + if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { + if (WEXITSTATUS(status) == 3) { + printf("\nYou need adb 1.0.32 or newer to sideload\nto this device.\n\n"); + result = -2; + } else if (!WIFSIGNALED(status)) { + printf("status %d\n", WEXITSTATUS(status)); + } } - return -1; - } - return 0; + set_usb_driver(false); + maybe_restart_adbd(); + return result; + } else { + return 0; + } + + return -1; // This should not happen } |