Merge \\"Remove an abused global so we can actually see logging.\\" am: 37450d7f42
am: 4692e5d8c8
Change-Id: Idf78bf71a0670997da754d0de93691db313aed57
This commit is contained in:
+11
-19
@@ -33,10 +33,7 @@
|
|||||||
#include "minadbd/fuse_adb_provider.h"
|
#include "minadbd/fuse_adb_provider.h"
|
||||||
#include "fuse_sideload.h"
|
#include "fuse_sideload.h"
|
||||||
|
|
||||||
static RecoveryUI* ui = NULL;
|
static void set_usb_driver(RecoveryUI* ui, bool enabled) {
|
||||||
|
|
||||||
static void
|
|
||||||
set_usb_driver(bool enabled) {
|
|
||||||
int fd = open("/sys/class/android_usb/android0/enable", O_WRONLY);
|
int fd = open("/sys/class/android_usb/android0/enable", O_WRONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
ui->Print("failed to open driver control: %s\n", strerror(errno));
|
ui->Print("failed to open driver control: %s\n", strerror(errno));
|
||||||
@@ -50,18 +47,16 @@ set_usb_driver(bool enabled) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void stop_adbd(RecoveryUI* ui) {
|
||||||
stop_adbd() {
|
ui->Print("Stopping adbd...\n");
|
||||||
property_set("ctl.stop", "adbd");
|
property_set("ctl.stop", "adbd");
|
||||||
set_usb_driver(false);
|
set_usb_driver(ui, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void maybe_restart_adbd(RecoveryUI* ui) {
|
||||||
static void
|
|
||||||
maybe_restart_adbd() {
|
|
||||||
if (is_ro_debuggable()) {
|
if (is_ro_debuggable()) {
|
||||||
ui->Print("Restarting adbd...\n");
|
ui->Print("Restarting adbd...\n");
|
||||||
set_usb_driver(true);
|
set_usb_driver(ui, true);
|
||||||
property_set("ctl.start", "adbd");
|
property_set("ctl.start", "adbd");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,14 +65,11 @@ maybe_restart_adbd() {
|
|||||||
// package, before timing out.
|
// package, before timing out.
|
||||||
#define ADB_INSTALL_TIMEOUT 300
|
#define ADB_INSTALL_TIMEOUT 300
|
||||||
|
|
||||||
int
|
int apply_from_adb(RecoveryUI* ui, bool* wipe_cache, const char* install_file) {
|
||||||
apply_from_adb(RecoveryUI* ui_, bool* wipe_cache, const char* install_file) {
|
|
||||||
modified_flash = true;
|
modified_flash = true;
|
||||||
|
|
||||||
ui = ui_;
|
stop_adbd(ui);
|
||||||
|
set_usb_driver(ui, true);
|
||||||
stop_adbd();
|
|
||||||
set_usb_driver(true);
|
|
||||||
|
|
||||||
ui->Print("\n\nNow send the package you want to apply\n"
|
ui->Print("\n\nNow send the package you want to apply\n"
|
||||||
"to the device with \"adb sideload <filename>\"...\n");
|
"to the device with \"adb sideload <filename>\"...\n");
|
||||||
@@ -137,8 +129,8 @@ apply_from_adb(RecoveryUI* ui_, bool* wipe_cache, const char* install_file) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set_usb_driver(false);
|
set_usb_driver(ui, false);
|
||||||
maybe_restart_adbd();
|
maybe_restart_adbd(ui);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user