1
mirror of https://github.com/DarkFlippers/unleashed-firmware.git synced 2025-12-13 13:09:49 +04:00

move part of the CLI to microsd to free up space for COMPACT 0 builds

CLI wrapper and idea by Willy-JL
This commit is contained in:
MX
2024-06-15 15:12:50 +03:00
parent dac9ff6c13
commit 5d4ed946cb
18 changed files with 202 additions and 62 deletions

View File

@@ -4,6 +4,10 @@
#include <furi_hal_version.h>
#include <loader/loader.h>
#include <flipper_application/plugins/plugin_manager.h>
#include <loader/firmware_api/firmware_api.h>
#include <inttypes.h>
#define TAG "CliSrv"
#define CLI_INPUT_LEN_LIMIT 256
@@ -482,3 +486,19 @@ int32_t cli_srv(void* p) {
return 0;
}
void cli_plugin_wrapper(const char* name, Cli* cli, FuriString* args, void* context) {
PluginManager* manager =
plugin_manager_alloc(CLI_PLUGIN_APP_ID, CLI_PLUGIN_API_VERSION, firmware_api_interface);
FuriString* path =
furi_string_alloc_printf(EXT_PATH("apps_data/cli/plugins/%s_cli.fal"), name);
PluginManagerError error = plugin_manager_load_single(manager, furi_string_get_cstr(path));
if(error == PluginManagerErrorNone) {
const CliCallback handler = plugin_manager_get_ep(manager, 0);
handler(cli, args, context);
} else {
printf("CLI plugin failed (code %" PRIu16 "), update firmware or check logs\r\n", error);
}
furi_string_free(path);
plugin_manager_free(manager);
}