diff --git a/res/doc b/res/doc index 2f9d3c7..6128778 100644 --- a/res/doc +++ b/res/doc @@ -41,10 +41,10 @@ # solitaire # sudoku # word_scramble -# misc - one of: +# nickel_misc - one of: # force_usb_connection - forces a usb connection dialog to be shown -# rescan_books - forces nickel to rescan books (TODO) -# rescan_books_full - forcez a full usb connect/disconnect cycle (TODO) +# rescan_books - forces nickel to rescan books +# rescan_books_full - forces a full usb connect/disconnect cycle # cmd_spawn - the command line to pass to /bin/sh -c (started in /) # cmd_output - the timeout in milliseconds (0 < t < 10000), a colon, then the command line to pass to /bin/sh -c (started in /) # diff --git a/src/action_cc.cc b/src/action_cc.cc index e33addb..87122e0 100644 --- a/src/action_cc.cc +++ b/src/action_cc.cc @@ -128,7 +128,20 @@ extern "C" int nm_action_nickelextras(const char *arg, char **err_out) { extern "C" int nm_action_nickelmisc(const char *arg, char **err_out) { #define NM_ERR_RET 1 - if (!strcmp(arg, "rescan_books_full")) { + if (!strcmp(arg, "rescan_books")) { + PlugWorkflowManager *(*PlugWorkflowManager_sharedInstance)(); + reinterpret_cast(PlugWorkflowManager_sharedInstance) = dlsym(RTLD_DEFAULT, "_ZN19PlugWorkflowManager14sharedInstanceEv"); + NM_ASSERT(PlugWorkflowManager_sharedInstance, "could not dlsym PlugWorkflowManager::sharedInstance"); + + void (*PlugWorkflowManager_sync)(PlugWorkflowManager*); + reinterpret_cast(PlugWorkflowManager_sync) = dlsym(RTLD_DEFAULT, "_ZN19PlugWorkflowManager4syncEv"); + NM_ASSERT(PlugWorkflowManager_sync, "could not dlsym PlugWorkflowManager::sync"); + + PlugWorkflowManager *wf = PlugWorkflowManager_sharedInstance(); + NM_ASSERT(wf, "could not get shared PlugWorkflowManager pointer"); + + PlugWorkflowManager_sync(wf); + } else if (!strcmp(arg, "rescan_books_full")) { PlugWorkflowManager *(*PlugWorkflowManager_sharedInstance)(); reinterpret_cast(PlugWorkflowManager_sharedInstance) = dlsym(RTLD_DEFAULT, "_ZN19PlugWorkflowManager14sharedInstanceEv"); NM_ASSERT(PlugWorkflowManager_sharedInstance, "could not dlsym PlugWorkflowManager::sharedInstance");