1
0
Fork 0
forked from len0rd/rockbox

[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
This commit is contained in:
William Wilgus 2023-03-20 22:15:33 -04:00 committed by William Wilgus
parent 2e99e2175b
commit a2e5d9563f
6 changed files with 176 additions and 123 deletions

View file

@ -85,7 +85,7 @@ static void kill_tsr(void)
rb->queue_delete(&queue);
}
static bool exit_tsr(bool reenter)
static int exit_tsr(bool reenter)
{
MENUITEM_STRINGLIST(menu, "USB test menu", NULL,
"Status", "Stop plugin", "Back");
@ -100,9 +100,9 @@ static bool exit_tsr(bool reenter)
case 1:
rb->splashf(HZ, "Stopping USB test thread");
kill_tsr();
return true;
return (reenter ? PLUGIN_TSR_TERMINATE : PLUGIN_TSR_SUSPEND);
case 2:
return false;
return PLUGIN_TSR_CONTINUE;
}
}
}
@ -119,14 +119,15 @@ static void run_tsr(void)
enum plugin_status plugin_start(const void* parameter)
{
(void)parameter;
bool resume = (parameter == rb->plugin_tsr);
MENUITEM_STRINGLIST(menu, "USB test menu", NULL,
"Start", "Quit");
switch(rb->do_menu(&menu, NULL, NULL, false)) {
switch(!resume ? rb->do_menu(&menu, NULL, NULL, false) : 0) {
case 0:
run_tsr();
rb->splashf(HZ, "Thread started");
rb->splashf(HZ, "USB test thread started");
return PLUGIN_OK;
case 1:
return PLUGIN_OK;