Skip to content

Commit

Permalink
Camera and center button now select. Add more mount and unmount optio…
Browse files Browse the repository at this point in the history
…ns. 1.7.0
  • Loading branch information
koush committed Mar 15, 2010
1 parent face588 commit b9546a8
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 3 additions & 2 deletions default_recovery_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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:
Expand Down
54 changes: 53 additions & 1 deletion extendedcommands.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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()
Expand Down
8 changes: 1 addition & 7 deletions extendedcommands.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -26,7 +20,7 @@ void
show_nandroid_restore_menu();

void
do_mount_usb_storage();
show_mount_menu();

void
show_choose_zip_menu();
Expand Down
5 changes: 5 additions & 0 deletions recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -465,6 +469,7 @@ prompt_and_wait()
case ITEM_MOUNT_USB:
do_mount_usb_storage();
break;
*/
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions recovery_ui.h
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
Expand Down

0 comments on commit b9546a8

Please sign in to comment.