diff options
author | Ethan Yonker <dees_troy@teamw.in> | 2015-10-09 18:15:26 +0200 |
---|---|---|
committer | Ethan Yonker <dees_troy@teamw.in> | 2015-10-09 18:15:29 +0200 |
commit | c798c9cd2486e0ff83776002c74f113677b10a84 (patch) | |
tree | d128a80cbc58e63a622fda2774e727611f9d2cd4 /adb_install.cpp | |
parent | Add TW_IGNORE_ABS_MT_TRACKING_ID (diff) | |
parent | merge in mnc-release history after reset to mnc-dev (diff) | |
download | android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar.gz android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar.bz2 android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar.lz android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar.xz android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.tar.zst android_bootable_recovery-c798c9cd2486e0ff83776002c74f113677b10a84.zip |
Diffstat (limited to 'adb_install.cpp')
-rw-r--r-- | adb_install.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/adb_install.cpp b/adb_install.cpp index 3e53066f5..5c54468d4 100644 --- a/adb_install.cpp +++ b/adb_install.cpp @@ -29,10 +29,8 @@ #include "ui.h" #include "cutils/properties.h" #include "adb_install.h" -extern "C" { #include "minadbd/fuse_adb_provider.h" #include "fuse_sideload.h" -} static RecoveryUI* ui = NULL; @@ -47,7 +45,8 @@ set_usb_driver(bool enabled) { printf("failed to open driver control: %s\n", strerror(errno)); return; } - if (write(fd, enabled ? "1" : "0", 1) < 0) { + + if (TEMP_FAILURE_RETRY(write(fd, enabled ? "1" : "0", 1)) == -1) { /* ui->Print("failed to set driver control: %s\n", strerror(errno)); */ @@ -67,12 +66,15 @@ stop_adbd() { set_usb_driver(false); } +bool is_ro_debuggable() { + char value[PROPERTY_VALUE_MAX+1]; + return (property_get("ro.debuggable", value, NULL) == 1 && value[0] == '1'); +} void maybe_restart_adbd() { char value[PROPERTY_VALUE_MAX+1]; - int len = property_get("ro.debuggable", value, NULL); - if (len == 1 && value[0] == '1') { + if (is_ro_debuggable()) { printf("Restarting adbd...\n"); set_usb_driver(true); property_set("ctl.start", "adbd"); |