diff options
Diffstat (limited to 'apps/debug_menu.c')
-rw-r--r-- | apps/debug_menu.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index 9bbbfaec99..f7e179b040 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -126,6 +126,10 @@ | |||
126 | #include "bootdata.h" | 126 | #include "bootdata.h" |
127 | #endif | 127 | #endif |
128 | 128 | ||
129 | #ifdef FIIO_M3K | ||
130 | #include "installer.h" | ||
131 | #endif | ||
132 | |||
129 | static const char* threads_getname(int selected_item, void *data, | 133 | static const char* threads_getname(int selected_item, void *data, |
130 | char *buffer, size_t buffer_len) | 134 | char *buffer, size_t buffer_len) |
131 | { | 135 | { |
@@ -2491,6 +2495,52 @@ static bool dbg_boot_data(void) | |||
2491 | } | 2495 | } |
2492 | #endif /* defined(HAVE_BOOTDATA) && !defined(SIMULATOR) */ | 2496 | #endif /* defined(HAVE_BOOTDATA) && !defined(SIMULATOR) */ |
2493 | 2497 | ||
2498 | #ifdef FIIO_M3K | ||
2499 | /* Note: this is temporary and should NOT be merged, ensure it is removed */ | ||
2500 | static int fiio_debug_menu_action_callback(int action, struct gui_synclist *lists) | ||
2501 | { | ||
2502 | if(action == ACTION_REDRAW) { | ||
2503 | simplelist_set_line_count(0); | ||
2504 | simplelist_addline("Back to menu"); | ||
2505 | simplelist_addline("Install bootloader"); | ||
2506 | simplelist_addline("Dump bootloader"); | ||
2507 | action = ACTION_REDRAW; | ||
2508 | } | ||
2509 | |||
2510 | if(action == ACTION_STD_OK) { | ||
2511 | int sel = gui_synclist_get_sel_pos(lists); | ||
2512 | int rc = 0; | ||
2513 | switch(sel) { | ||
2514 | case 1: | ||
2515 | rc = install_bootloader("/boot.install"); | ||
2516 | break; | ||
2517 | case 2: | ||
2518 | rc = dump_bootloader("/boot.dump"); | ||
2519 | break; | ||
2520 | default: | ||
2521 | break; | ||
2522 | } | ||
2523 | |||
2524 | if(sel == 1 || sel == 2) { | ||
2525 | const char* msg = installer_strerror(rc); | ||
2526 | splashf(3*HZ, "(%d) %s", rc, msg); | ||
2527 | } | ||
2528 | |||
2529 | action = ACTION_STD_CANCEL; | ||
2530 | } | ||
2531 | |||
2532 | return action; | ||
2533 | } | ||
2534 | |||
2535 | static bool dbg_fiio_menu(void) | ||
2536 | { | ||
2537 | struct simplelist_info info; | ||
2538 | simplelist_info_init(&info, "FiiO debug menu", 3, NULL); | ||
2539 | info.action_callback = fiio_debug_menu_action_callback; | ||
2540 | return simplelist_show_list(&info); | ||
2541 | } | ||
2542 | #endif | ||
2543 | |||
2494 | /****** The menu *********/ | 2544 | /****** The menu *********/ |
2495 | static const struct { | 2545 | static const struct { |
2496 | unsigned char *desc; /* string or ID */ | 2546 | unsigned char *desc; /* string or ID */ |
@@ -2598,6 +2648,9 @@ static const struct { | |||
2598 | #if defined(HAVE_BOOTDATA) && !defined(SIMULATOR) | 2648 | #if defined(HAVE_BOOTDATA) && !defined(SIMULATOR) |
2599 | {"Boot data", dbg_boot_data }, | 2649 | {"Boot data", dbg_boot_data }, |
2600 | #endif | 2650 | #endif |
2651 | #ifdef FIIO_M3K | ||
2652 | {"FiiO debug menu", dbg_fiio_menu}, | ||
2653 | #endif | ||
2601 | }; | 2654 | }; |
2602 | 2655 | ||
2603 | static int menu_action_callback(int btn, struct gui_synclist *lists) | 2656 | static int menu_action_callback(int btn, struct gui_synclist *lists) |