usb mass storage support. user initiated recovery is now user friendly.
diff --git a/default_recovery_ui.c b/default_recovery_ui.c
index 2b78e0c..458c817 100644
--- a/default_recovery_ui.c
+++ b/default_recovery_ui.c
@@ -29,7 +29,8 @@
"install zip from sdcard",
"backup",
"restore",
- "mount sdcard",
+ "mount /sdcard",
+ "mount USB storage",
NULL };
int device_toggle_display(volatile char* key_pressed, int key_code) {
diff --git a/extendedcommands.c b/extendedcommands.c
index 4074d38..a63163a 100644
--- a/extendedcommands.c
+++ b/extendedcommands.c
@@ -358,4 +358,26 @@
return;
}
ui_print("Restore complete.\n");
+}
+
+void do_mount_usb_storage()
+{
+ system("echo /dev/block/mmcblk0 > /sys/devices/platform/usb_mass_storage/lun0/file");
+ static char* headers[] = { "USB Mass Storage device",
+ "Leaving this menu unmount",
+ "your SD card from your PC.",
+ "",
+ NULL
+ };
+
+ static char* list[] = { "Unmount", NULL };
+
+ for (;;)
+ {
+ int chosen_item = get_menu_selection(headers, list, 0);
+ if (chosen_item == GO_BACK || chosen_item == 0)
+ break;
+ }
+
+ system("echo 0 > /sys/devices/platform/usb_mass_storage/lun0/enable");
}
\ No newline at end of file
diff --git a/extendedcommands.h b/extendedcommands.h
index 00dff0f..5629c41 100644
--- a/extendedcommands.h
+++ b/extendedcommands.h
@@ -13,11 +13,14 @@
int
get_allow_toggle_display();
-int
-ui_get_show_menu();
+void
+ui_set_show_text(int value);
void
do_nandroid_backup();
void
-show_nandroid_restore_menu();
\ No newline at end of file
+show_nandroid_restore_menu();
+
+void
+do_mount_usb_storage();
\ No newline at end of file
diff --git a/recovery.c b/recovery.c
index 7759568..4dd8833 100644
--- a/recovery.c
+++ b/recovery.c
@@ -456,6 +456,9 @@
LOGE ("Can't mount /sdcard\n");
}
break;
+ case ITEM_MOUNT_USB:
+ do_mount_usb_storage();
+ break;
}
}
}
@@ -469,6 +472,7 @@
int
main(int argc, char **argv)
{
+ int is_user_initiated_recovery = 0;
time_t start = time(NULL);
// If these fail, there's not really anywhere to complain...
@@ -528,9 +532,14 @@
if (status != INSTALL_SUCCESS) ui_print("Cache wipe failed.\n");
} else {
status = INSTALL_ERROR; // No command specified
+ // we are starting up in user initiated recovery here
+ // let's set up some default options
+ signature_check_enabled = 0;
+ is_user_initiated_recovery = 1;
+ ui_set_show_text(1);
}
- if (status != INSTALL_SUCCESS) ui_set_background(BACKGROUND_ICON_ERROR);
+ if (status != INSTALL_SUCCESS && !is_user_initiated_recovery) ui_set_background(BACKGROUND_ICON_ERROR);
if (status != INSTALL_SUCCESS || ui_text_visible()) prompt_and_wait();
// If there is a radio image pending, reboot now to install it.
diff --git a/recovery_ui.h b/recovery_ui.h
index 7165007..51f8817 100644
--- a/recovery_ui.h
+++ b/recovery_ui.h
@@ -71,6 +71,7 @@
#define ITEM_BACKUP 5
#define ITEM_RESTORE 6
#define ITEM_MOUNT_SDCARD 7
+#define ITEM_MOUNT_USB 8
// Header text to display above the main menu.
extern char* MENU_HEADERS[];
diff --git a/ui.c b/ui.c
index fdb11f4..5d1bf67 100644
--- a/ui.c
+++ b/ui.c
@@ -553,6 +553,6 @@
pthread_mutex_unlock(&key_queue_mutex);
}
-void ui_get_show_menu() {
- return show_menu;
+void ui_set_show_text(int value) {
+ show_text = value;
}