diff options
-rw-r--r-- | apps/menus/plugin_menu.c | 17 | ||||
-rw-r--r-- | apps/tree.c | 1 | ||||
-rw-r--r-- | firmware/usb.c | 2 | ||||
-rw-r--r-- | uisimulator/common/sim_tasks.c | 2 |
4 files changed, 16 insertions, 6 deletions
diff --git a/apps/menus/plugin_menu.c b/apps/menus/plugin_menu.c index 7f29e61af4..7edfc7acc6 100644 --- a/apps/menus/plugin_menu.c +++ b/apps/menus/plugin_menu.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include "rbpaths.h" | 29 | #include "rbpaths.h" |
30 | #include "root_menu.h" | 30 | #include "root_menu.h" |
31 | #include "tree.h" | 31 | #include "tree.h" |
32 | static int reenter = 0; | ||
33 | 32 | ||
34 | enum { | 33 | enum { |
35 | GAMES, | 34 | GAMES, |
@@ -46,6 +45,12 @@ static const struct { | |||
46 | { PLUGIN_DEMOS_DIR, LANG_PLUGIN_DEMOS }, | 45 | { PLUGIN_DEMOS_DIR, LANG_PLUGIN_DEMOS }, |
47 | }; | 46 | }; |
48 | 47 | ||
48 | /* if handler is active we are waiting to reenter menu */ | ||
49 | static void pm_handler(unsigned short id, void *data) | ||
50 | { | ||
51 | remove_event(id, data); | ||
52 | } | ||
53 | |||
49 | static int plugins_menu(void* param) | 54 | static int plugins_menu(void* param) |
50 | { | 55 | { |
51 | intptr_t item = (intptr_t)param; | 56 | intptr_t item = (intptr_t)param; |
@@ -60,7 +65,8 @@ static int plugins_menu(void* param) | |||
60 | if (ret == GO_TO_PREVIOUS) | 65 | if (ret == GO_TO_PREVIOUS) |
61 | return 0; | 66 | return 0; |
62 | if (ret == GO_TO_PLUGIN) | 67 | if (ret == GO_TO_PLUGIN) |
63 | reenter = 1; | 68 | add_event(SYS_EVENT_USB_INSERTED, pm_handler); |
69 | |||
64 | return ret; | 70 | return ret; |
65 | } | 71 | } |
66 | 72 | ||
@@ -74,8 +80,11 @@ static int menu_callback(int action, | |||
74 | if (action == ACTION_ENTER_MENUITEM) | 80 | if (action == ACTION_ENTER_MENUITEM) |
75 | { | 81 | { |
76 | this_list->selected_item = selected; | 82 | this_list->selected_item = selected; |
77 | if (reenter-- > 0) | 83 | if (!add_event(SYS_EVENT_USB_INSERTED, pm_handler)) |
78 | action = ACTION_STD_OK; | 84 | { |
85 | action = ACTION_STD_OK; /* event exists -- reenter menu */ | ||
86 | } | ||
87 | remove_event(SYS_EVENT_USB_INSERTED, pm_handler); | ||
79 | } | 88 | } |
80 | else if (action == ACTION_STD_OK) | 89 | else if (action == ACTION_STD_OK) |
81 | { | 90 | { |
diff --git a/apps/tree.c b/apps/tree.c index e35f769a14..63363422ba 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -1196,6 +1196,7 @@ static int ft_play_filename(char *dir, char *file, int attr) | |||
1196 | /* These two functions are called by the USB and shutdown handlers */ | 1196 | /* These two functions are called by the USB and shutdown handlers */ |
1197 | void tree_flush(void) | 1197 | void tree_flush(void) |
1198 | { | 1198 | { |
1199 | tc.browse = NULL; /* clear browse to prevent reentry to a possibly missing file */ | ||
1199 | #ifdef HAVE_TAGCACHE | 1200 | #ifdef HAVE_TAGCACHE |
1200 | tagcache_shutdown(); | 1201 | tagcache_shutdown(); |
1201 | #endif | 1202 | #endif |
diff --git a/firmware/usb.c b/firmware/usb.c index 898df0d434..4e13295509 100644 --- a/firmware/usb.c +++ b/firmware/usb.c | |||
@@ -478,7 +478,7 @@ static void NORETURN_ATTR usb_thread(void) | |||
478 | usb_stack_enable(true); | 478 | usb_stack_enable(true); |
479 | #ifndef BOOTLOADER | 479 | #ifndef BOOTLOADER |
480 | #ifndef HAVE_USB_POWER | 480 | #ifndef HAVE_USB_POWER |
481 | int usb_mode = 0; | 481 | int usb_mode = USBMODE_DEFAULT; |
482 | #endif | 482 | #endif |
483 | send_event(SYS_EVENT_USB_INSERTED, &usb_mode); | 483 | send_event(SYS_EVENT_USB_INSERTED, &usb_mode); |
484 | #endif | 484 | #endif |
diff --git a/uisimulator/common/sim_tasks.c b/uisimulator/common/sim_tasks.c index 809b50569f..feb88e2c58 100644 --- a/uisimulator/common/sim_tasks.c +++ b/uisimulator/common/sim_tasks.c | |||
@@ -145,7 +145,7 @@ void sim_trigger_screendump(void) | |||
145 | static bool is_usb_inserted; | 145 | static bool is_usb_inserted; |
146 | void sim_trigger_usb(bool inserted) | 146 | void sim_trigger_usb(bool inserted) |
147 | { | 147 | { |
148 | int usbmode = 0; | 148 | int usbmode = USBMODE_DEFAULT; |
149 | if (inserted) | 149 | if (inserted) |
150 | { | 150 | { |
151 | send_event(SYS_EVENT_USB_INSERTED, &usbmode); | 151 | send_event(SYS_EVENT_USB_INSERTED, &usbmode); |