int start_menu_mode(struct s_hardware *hardware, char *version_string) { struct s_hdt_menu hdt_menu; memset(&hdt_menu, 0, sizeof(hdt_menu)); /* Setup the menu system */ setup_menu(version_string); /* Compute all submenus */ compute_submenus(&hdt_menu, hardware); /* Compute the main menu */ compute_main_menu(&hdt_menu, hardware); #ifdef WITH_MENU_DISPLAY t_menuitem *curr; char cmd[160]; if (!quiet) more_printf("Starting Menu (%d menus)\n", hdt_menu.total_menu_count); curr = showmenus(hdt_menu.main_menu.menu); /* When we exit the menu, do we have something to do? */ if (curr) { /* When want to execute something */ if (curr->action == OPT_RUN) { /* Tweak, we want to switch to the cli */ if (!strncmp (curr->data, HDT_SWITCH_TO_CLI, sizeof(HDT_SWITCH_TO_CLI))) { return HDT_RETURN_TO_CLI; } /* Tweak, we want to start the dump mode */ if (!strncmp (curr->data, HDT_DUMP, sizeof(HDT_DUMP))) { dump(hardware); return 0; } if (!strncmp (curr->data, HDT_REBOOT, sizeof(HDT_REBOOT))) { syslinux_reboot(1); } strcpy(cmd, curr->data); /* Use specific syslinux call if needed */ if (issyslinux()) runsyslinuxcmd(cmd); else csprint(cmd, 0x07); return 1; // Should not happen when run from SYSLINUX } } #endif return 0; }
/* Reboot */ void rosh_reboot(void) { // char cmdstr[ROSH_CMD_SZ]; // printf syslinux_reboot(0); } /* rosh_reboot */
int main(int argc, char *argv[]) { struct driveinfo drive; struct driveinfo *d = &drive; char buffer[4096] = {0}; unsigned int index = 0; int ret, progress, progress_old; int rows, cols; (void)argc; (void)argv; openconsole(&dev_stdcon_r, &dev_stdcon_w); if (getscreensize(1, &rows, &cols)) { /* Unknown screen size? */ rows = 24; cols = 80; } memset(buffer, 'A', 4096); memcpy(buffer, boot_code, sizeof(boot_code)); buffer[510] = 0x55; buffer[511] = 0xaa; printf("DWIPE version %s, by sTeeL <*****@*****.**>\n", __DWIPE_VERSION__); printf("remove USB DISK and hit ENTER key\n"); get_key(stdin, 0); for (int disk = 0x80; disk < 0xff; disk++) { memset(d, 0, sizeof(struct driveinfo)); d->disk = disk; get_drive_parameters(d); /* Do not print output when drive does not exists */ if (errno_disk == -1 || !d->cbios) continue; if (errno_disk) { get_error("reading disk"); continue; } printf("DISK 0x%X:\n", d->disk); printf(" C/H/S: %d heads, %d cylinders\n", d->legacy_max_head + 1, d->legacy_max_cylinder + 1); printf(" %d sectors/track, %d drives\n", d->legacy_sectors_per_track, d->legacy_max_drive); printf(" EDD: ebios=%d, EDD version: %X\n", d->ebios, d->edd_version); printf(" %d heads, %d cylinders\n", (int) d->edd_params.heads, (int) d->edd_params.cylinders); printf(" %d sectors, %d bytes/sector, %d sectors/track\n", (int) d->edd_params.sectors, (int) d->edd_params.bytes_per_sector, (int) d->edd_params.sectors_per_track); printf(" Host bus: %s, Interface type: %s\n\n", d->edd_params.host_bus_type, d->edd_params.interface_type); progress_old = 0; print_progress(0, cols); for(index = 0; index < d->edd_params.sectors ; index += 8 ) { ret = dwipe_write_sectors(d, index, buffer, 8); if(ret == -1) { printf("ERROR!\n"); continue; } else { progress = index * 100 / d->edd_params.sectors; if(progress != progress_old) { progress_old = progress; print_progress(progress, cols); } } } print_progress(100, cols); printf("\nDONE\n\n"); } syslinux_reboot(0); return 0; }