Camera and center button now select. Add more mount and unmount options. 1.7.0

This commit is contained in:
Koushik K. Dutta 2010-03-14 22:42:30 -07:00
parent face588f64
commit b9546a8047
7 changed files with 65 additions and 13 deletions

View File

@ -26,7 +26,7 @@ LOCAL_MODULE := recovery
LOCAL_FORCE_STATIC_EXECUTABLE := true
RECOVERY_API_VERSION := 1.6.9
RECOVERY_API_VERSION := 1.7.0
LOCAL_CFLAGS += -DRECOVERY_API_VERSION=$(RECOVERY_API_VERSION)
# This binary is in the recovery ramdisk, which is otherwise a copy of root.

View File

@ -34,6 +34,7 @@ void ui_clear_key_queue();
void ui_print(const char *fmt, ...);
void ui_reset_text_col();
void ui_set_show_text(int value);
// Display some header text followed by a menu of items, which appears
// at the top of the screen (in place of any scrolling ui_print()

View File

@ -29,8 +29,7 @@ char* MENU_ITEMS[] = { "reboot system now",
"install zip from sdcard",
"backup",
"restore",
"mount /sdcard",
"mount USB storage",
"mount partitions",
NULL };
int device_toggle_display(volatile char* key_pressed, int key_code) {
@ -58,6 +57,8 @@ int device_handle_key(int key_code, int visible) {
case KEY_ENTER:
case BTN_MOUSE:
case KEY_CENTER:
case KEY_CAMERA:
return SELECT_ITEM;
case KEY_POWER:

View File

@ -356,7 +356,7 @@ void show_nandroid_restore_menu()
nandroid_restore(file);
}
void do_mount_usb_storage()
void show_mount_usb_storage_menu()
{
system("echo /dev/block/mmcblk0 > /sys/devices/platform/usb_mass_storage/lun0/file");
static char* headers[] = { "USB Mass Storage device",
@ -379,6 +379,58 @@ void do_mount_usb_storage()
system("echo 0 > /sys/devices/platform/usb_mass_storage/lun0/enable");
}
void show_mount_menu()
{
static char* headers[] = { "Mount and unmount partitions",
"",
NULL
};
typedef char* string;
string mounts[3][3] = {
{ "mount /system", "unmount /system", "SYSTEM:" },
{ "mount /data", "unmount /data", "DATA:" },
{ "mount /cache", "unmount /cache", "CACHE:" }
};
for (;;)
{
int ismounted[3];
int i;
static string options[5];
for (i = 0; i < 3; i++)
{
ismounted[i] = is_root_path_mounted(mounts[i][2]);
options[i] = ismounted[i] ? mounts[i][1] : mounts[i][0];
}
options[3] = "mount USB storage";
options[4] = NULL;
int chosen_item = get_menu_selection(headers, options, 0);
if (chosen_item == GO_BACK)
break;
if (chosen_item == 4)
{
show_mount_usb_storage_menu();
}
else if (chosen_item < 4)
{
if (ismounted[chosen_item])
{
if (0 != ensure_root_path_unmounted(mounts[chosen_item][2]))
ui_print("Error unmounting %s!\n", mounts[chosen_item][2]);
}
else
{
if (0 != ensure_root_path_mounted(mounts[chosen_item][2]))
ui_print("Error mounting %s!\n", mounts[chosen_item][2]);
}
}
}
}
#define EXTENDEDCOMMAND_SCRIPT "/cache/recovery/extendedcommand"
int extendedcommand_file_exists()

View File

@ -10,12 +10,6 @@ toggle_script_asserts();
void
show_choose_zip_menu();
int
get_allow_toggle_display();
void
ui_set_show_text(int value);
int
do_nandroid_backup(char* backup_name);
@ -26,7 +20,7 @@ void
show_nandroid_restore_menu();
void
do_mount_usb_storage();
show_mount_menu();
void
show_choose_zip_menu();

View File

@ -457,6 +457,10 @@ prompt_and_wait()
case ITEM_RESTORE:
show_nandroid_restore_menu();
break;
case ITEM_MOUNT:
show_mount_menu();
break;
/*
case ITEM_MOUNT_SDCARD:
if (ensure_root_path_mounted("SDCARD:") != 0) {
LOGE ("Can't mount /sdcard\n");
@ -465,6 +469,7 @@ prompt_and_wait()
case ITEM_MOUNT_USB:
do_mount_usb_storage();
break;
*/
}
}
}

View File

@ -70,8 +70,7 @@ int device_wipe_data();
#define ITEM_INSTALL_ZIP 4
#define ITEM_BACKUP 5
#define ITEM_RESTORE 6
#define ITEM_MOUNT_SDCARD 7
#define ITEM_MOUNT_USB 8
#define ITEM_MOUNT 7
// Header text to display above the main menu.
extern char* MENU_HEADERS[];