diff options
author | William Wilgus <wilgus.william@gmail.com> | 2023-03-20 22:15:33 -0400 |
---|---|---|
committer | William Wilgus <me.theuser@yahoo.com> | 2023-03-25 10:02:43 -0400 |
commit | a2e5d9563f9dec84907f4f2060af6dfad895c4ba (patch) | |
tree | e2c27f4fca350e1f1ce8ba2ef8fe30fbb341c3c0 /apps/plugins/test_usb.c | |
parent | 2e99e2175b48cc00274b03bb4aecf5d01403110d (diff) | |
download | rockbox-a2e5d9563f9dec84907f4f2060af6dfad895c4ba.tar.gz rockbox-a2e5d9563f9dec84907f4f2060af6dfad895c4ba.zip |
[Feature] resume TSR plugins after interruption WIP
save tsr plugin path for later
resume tsr plugin when user stops the interrupting plugin
expand return of tsr_exit function to allow
continue, suspend, terminate
tsr plugins check parameter at start to determine if
the plugin is being resumed
Change-Id: I6fc70de664c7771e7dbc9a1af7a831e7b50b1d15
Diffstat (limited to 'apps/plugins/test_usb.c')
-rw-r--r-- | apps/plugins/test_usb.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/apps/plugins/test_usb.c b/apps/plugins/test_usb.c index 6bb77c40be..28ef8f7e5f 100644 --- a/apps/plugins/test_usb.c +++ b/apps/plugins/test_usb.c | |||
@@ -85,7 +85,7 @@ static void kill_tsr(void) | |||
85 | rb->queue_delete(&queue); | 85 | rb->queue_delete(&queue); |
86 | } | 86 | } |
87 | 87 | ||
88 | static bool exit_tsr(bool reenter) | 88 | static int exit_tsr(bool reenter) |
89 | { | 89 | { |
90 | MENUITEM_STRINGLIST(menu, "USB test menu", NULL, | 90 | MENUITEM_STRINGLIST(menu, "USB test menu", NULL, |
91 | "Status", "Stop plugin", "Back"); | 91 | "Status", "Stop plugin", "Back"); |
@@ -100,9 +100,9 @@ static bool exit_tsr(bool reenter) | |||
100 | case 1: | 100 | case 1: |
101 | rb->splashf(HZ, "Stopping USB test thread"); | 101 | rb->splashf(HZ, "Stopping USB test thread"); |
102 | kill_tsr(); | 102 | kill_tsr(); |
103 | return true; | 103 | return (reenter ? PLUGIN_TSR_TERMINATE : PLUGIN_TSR_SUSPEND); |
104 | case 2: | 104 | case 2: |
105 | return false; | 105 | return PLUGIN_TSR_CONTINUE; |
106 | } | 106 | } |
107 | } | 107 | } |
108 | } | 108 | } |
@@ -119,14 +119,15 @@ static void run_tsr(void) | |||
119 | 119 | ||
120 | enum plugin_status plugin_start(const void* parameter) | 120 | enum plugin_status plugin_start(const void* parameter) |
121 | { | 121 | { |
122 | (void)parameter; | 122 | bool resume = (parameter == rb->plugin_tsr); |
123 | |||
123 | MENUITEM_STRINGLIST(menu, "USB test menu", NULL, | 124 | MENUITEM_STRINGLIST(menu, "USB test menu", NULL, |
124 | "Start", "Quit"); | 125 | "Start", "Quit"); |
125 | 126 | ||
126 | switch(rb->do_menu(&menu, NULL, NULL, false)) { | 127 | switch(!resume ? rb->do_menu(&menu, NULL, NULL, false) : 0) { |
127 | case 0: | 128 | case 0: |
128 | run_tsr(); | 129 | run_tsr(); |
129 | rb->splashf(HZ, "Thread started"); | 130 | rb->splashf(HZ, "USB test thread started"); |
130 | return PLUGIN_OK; | 131 | return PLUGIN_OK; |
131 | case 1: | 132 | case 1: |
132 | return PLUGIN_OK; | 133 | return PLUGIN_OK; |