static void
prompt_and_wait() {
  char** headers = prepend_title((const char**)MENU_HEADERS);
  int select = 0;

  for (;;) {
    ui_reset_progress();
    int chosen_item = get_menu_selection(headers, MENU_ITEMS, 0, select);

    // device-specific code may take some action here.  It may
    // return one of the core actions handled in the switch
    // statement below.
    chosen_item = device_perform_action(chosen_item);
    switch (chosen_item) {
      case ITEM_BOOT:
        if (show_menu_boot()) return; else break;
      case ITEM_SYSTEM:
        if (show_menu_system()) return; else break;
      case ITEM_RECOVERY:
        if (show_menu_recovery()) return; else break;
      case ITEM_TOOLS:
        if (show_menu_tools()) return; else break;
      case ITEM_REBOOT:
        ui_print("Reboot now....\n");
        sync();
        reboot(RB_AUTOBOOT);
        return;
    }
    select = chosen_item;
  }
}
Esempio n. 2
0
/**
 * prompt_and_wait()
 *
 */
static void prompt_and_wait() {

  int select = 0;

  for (;;) {

    int chosen_item = get_menu_selection(main_headers, MENU_ITEMS, 0, select);

    // device-specific code may take some action here.  It may
    // return one of the core actions handled in the switch
    // statement below.

    if (chosen_item >= 0 && chosen_item <= ITEM_LAST) {

      switch (chosen_item) {
      case ITEM_REBOOT:
        sync();
        reboot_wrapper(NULL);
        return;
      case ITEM_BOOT:
        if (show_menu_boot()) return;
        break;
#if STOCK_VERSION
      case ITEM_SYSTEM:
        if (show_menu_system()) return;
        break;
#elif !defined(NO_OVERCLOCK)
      case ITEM_OVERCLOCK:
        if (show_menu_overclock()) return;
        break;
#endif
      case ITEM_RECOVERY:
        if (show_menu_recovery()) return;
        break;
      case ITEM_TOOLS:
        if (show_menu_tools()) return;
        break;
      case ITEM_POWEROFF:
        sync();
        __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_POWER_OFF, NULL);
        return;
      }

      select = chosen_item;
    }
  }
}