Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0317378b authored by Koushik K. Dutta's avatar Koushik K. Dutta
Browse files

usb mass storage support. user initiated recovery is now user friendly.

parent ea2f2428
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -29,7 +29,8 @@ char* MENU_ITEMS[] = { "reboot system now",
                       "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) {
+22 −0
Original line number Diff line number Diff line
@@ -359,3 +359,25 @@ void show_nandroid_restore_menu()
    }
    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
+6 −3
Original line number Diff line number Diff line
@@ -13,11 +13,14 @@ show_choose_zip_menu();
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();

void
do_mount_usb_storage();
 No newline at end of file
+10 −1
Original line number Diff line number Diff line
@@ -456,6 +456,9 @@ prompt_and_wait()
                    LOGE ("Can't mount /sdcard\n");
                }    
                break;
            case ITEM_MOUNT_USB:
                do_mount_usb_storage();
                break;
        }
    }
}
@@ -469,6 +472,7 @@ print_property(const char *key, const char *name, void *cookie)
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 @@ main(int argc, char **argv)
        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.
+1 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ int device_wipe_data();
#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[];
Loading