summaryrefslogtreecommitdiff
path: root/apps/root_menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/root_menu.c')
-rw-r--r--apps/root_menu.c57
1 files changed, 26 insertions, 31 deletions
diff --git a/apps/root_menu.c b/apps/root_menu.c
index ed6bdfdcca..f731531e16 100644
--- a/apps/root_menu.c
+++ b/apps/root_menu.c
@@ -709,47 +709,41 @@ static int load_context_screen(int selection)
709 709
710static int load_plugin_screen(char *key) 710static int load_plugin_screen(char *key)
711{ 711{
712 int ret_val; 712 int ret_val = PLUGIN_ERROR;
713 int loops = 100;
713 int old_previous = last_screen; 714 int old_previous = last_screen;
714 int old_global = global_status.last_screen; 715 int old_global = global_status.last_screen;
715 last_screen = next_screen; 716 last_screen = next_screen;
716 global_status.last_screen = (char)next_screen; 717 global_status.last_screen = (char)next_screen;
717 status_save(); 718 status_save();
718 719
719 int opret = open_plugin_get_entry(key, &open_plugin_entry); 720 while(loops-- > 0) /* just to keep things from getting out of hand */
720 char *path = open_plugin_entry.path;
721 char *param = open_plugin_entry.param;
722 if (param[0] == '\0')
723 param = NULL;
724
725 switch (plugin_load(path, param))
726 { 721 {
727 case PLUGIN_USB_CONNECTED: 722 int opret = open_plugin_get_entry(key, &open_plugin_entry);
728 ret_val = GO_TO_ROOT; 723 char *path = open_plugin_entry.path;
729 break; 724 char *param = open_plugin_entry.param;
730 case PLUGIN_GOTO_WPS: 725 if (param[0] == '\0')
731 ret_val = GO_TO_WPS; 726 param = NULL;
732 break; 727
733 case PLUGIN_GOTO_PLUGIN: 728 int ret = plugin_load(path, param);
734 ret_val = GO_TO_PLUGIN; 729
735 break; 730 if (ret == PLUGIN_USB_CONNECTED)
736 case PLUGIN_OK:
737 /* Prevents infinite loop with WPS & Plugins*/
738 if (old_global == GO_TO_WPS && !audio_status())
739 {
740 ret_val = GO_TO_ROOT; 731 ret_val = GO_TO_ROOT;
741 break; 732 else if (ret == PLUGIN_GOTO_WPS)
733 ret_val = GO_TO_WPS;
734 else if (ret == PLUGIN_GOTO_PLUGIN)
735 continue;
736 else
737 {
738 /* Prevents infinite loop with WPS & Plugins*/
739 if (ret == PLUGIN_OK && old_global == GO_TO_WPS && !audio_status())
740 ret_val = GO_TO_ROOT;
741 ret_val = GO_TO_PREVIOUS;
742 last_screen = (old_previous == next_screen) ? GO_TO_ROOT : old_previous;
742 } 743 }
743 /*fallthrough*/
744 default:
745 ret_val = GO_TO_PREVIOUS;
746 last_screen = (old_previous == next_screen) ? GO_TO_ROOT : old_previous;
747 break;
748 744
749 } 745 /* ret_val != GO_TO_PLUGIN */
750 746
751 if (ret_val != GO_TO_PLUGIN)
752 {
753 if (opret != OPEN_PLUGIN_NEEDS_FLUSHED || last_screen != GO_TO_WPS) 747 if (opret != OPEN_PLUGIN_NEEDS_FLUSHED || last_screen != GO_TO_WPS)
754 { 748 {
755 /* Keep the entry in case of GO_TO_PREVIOUS */ 749 /* Keep the entry in case of GO_TO_PREVIOUS */
@@ -757,7 +751,8 @@ static int load_plugin_screen(char *key)
757 open_plugin_entry.lang_id = LANG_PREVIOUS_SCREEN; 751 open_plugin_entry.lang_id = LANG_PREVIOUS_SCREEN;
758 /*open_plugin_add_path(NULL, NULL, NULL);// clear entry */ 752 /*open_plugin_add_path(NULL, NULL, NULL);// clear entry */
759 } 753 }
760 } 754 break;
755 } /*while */
761 return ret_val; 756 return ret_val;
762} 757}
763 758