diff --git a/applications/main/ibutton/application.fam b/applications/main/ibutton/application.fam index 4f57148f8..d33519580 100644 --- a/applications/main/ibutton/application.fam +++ b/applications/main/ibutton/application.fam @@ -11,11 +11,20 @@ App( fap_category="iButton", ) +App( + appid="ibutton_cli", + targets=["f7"], + apptype=FlipperAppType.PLUGIN, + entry_point="ibutton_cli_plugin_ep", + requires=["cli"], + sources=["ibutton_cli.c"], +) + App( appid="ibutton_start", apptype=FlipperAppType.STARTUP, targets=["f7"], entry_point="ibutton_on_system_start", - sources=["ibutton_cli.c"], + sources=["ibutton_start.c"], order=60, ) diff --git a/applications/main/ibutton/ibutton_cli.c b/applications/main/ibutton/ibutton_cli.c index 12da64fcc..ca179efb8 100644 --- a/applications/main/ibutton/ibutton_cli.c +++ b/applications/main/ibutton/ibutton_cli.c @@ -8,19 +8,6 @@ #include #include -static void ibutton_cli(Cli* cli, FuriString* args, void* context); - -// app cli function -void ibutton_on_system_start() { -#ifdef SRV_CLI - Cli* cli = furi_record_open(RECORD_CLI); - cli_add_command(cli, "ikey", CliCommandFlagDefault, ibutton_cli, cli); - furi_record_close(RECORD_CLI); -#else - UNUSED(ibutton_cli); -#endif -} - static void ibutton_cli_print_usage() { printf("Usage:\r\n"); printf("ikey read\r\n"); @@ -252,3 +239,15 @@ void ibutton_cli(Cli* cli, FuriString* args, void* context) { furi_string_free(cmd); } + +#include + +static const FlipperAppPluginDescriptor plugin_descriptor = { + .appid = "ibutton_cli", + .ep_api_version = 1, + .entry_point = &ibutton_cli, +}; + +const FlipperAppPluginDescriptor* ibutton_cli_plugin_ep() { + return &plugin_descriptor; +} diff --git a/applications/main/ibutton/ibutton_start.c b/applications/main/ibutton/ibutton_start.c new file mode 100644 index 000000000..ca07becf5 --- /dev/null +++ b/applications/main/ibutton/ibutton_start.c @@ -0,0 +1,11 @@ +#include + +static void ibutton_cli_wrapper(Cli* cli, FuriString* args, void* context) { + cli_plugin_wrapper("ibutton_cli", 1, cli, args, context); +} + +void ibutton_on_system_start() { + Cli* cli = furi_record_open(RECORD_CLI); + cli_add_command(cli, "ikey", CliCommandFlagDefault, ibutton_cli_wrapper, cli); + furi_record_close(RECORD_CLI); +} diff --git a/applications/main/infrared/application.fam b/applications/main/infrared/application.fam index 57e3f9ce6..8ffaafa34 100644 --- a/applications/main/infrared/application.fam +++ b/applications/main/infrared/application.fam @@ -14,14 +14,23 @@ App( ) App( - appid="infrared_start", - apptype=FlipperAppType.STARTUP, + appid="infrared_cli", targets=["f7"], - entry_point="infrared_on_system_start", + apptype=FlipperAppType.PLUGIN, + entry_point="infrared_cli_plugin_ep", + requires=["cli"], sources=[ "infrared_cli.c", "infrared_brute_force.c", "infrared_signal.c", ], +) + +App( + appid="infrared_start", + apptype=FlipperAppType.STARTUP, + targets=["f7"], + entry_point="infrared_on_system_start", + sources=["infrared_start.c"], order=20, ) diff --git a/applications/main/infrared/infrared_cli.c b/applications/main/infrared/infrared_cli.c index 8ac3e65b6..acc18ef08 100644 --- a/applications/main/infrared/infrared_cli.c +++ b/applications/main/infrared/infrared_cli.c @@ -544,12 +544,15 @@ static void infrared_cli_start_ir(Cli* cli, FuriString* args, void* context) { furi_string_free(command); } -void infrared_on_system_start() { -#ifdef SRV_CLI - Cli* cli = (Cli*)furi_record_open(RECORD_CLI); - cli_add_command(cli, "ir", CliCommandFlagDefault, infrared_cli_start_ir, NULL); - furi_record_close(RECORD_CLI); -#else - UNUSED(infrared_cli_start_ir); -#endif + +#include + +static const FlipperAppPluginDescriptor plugin_descriptor = { + .appid = "infrared_cli", + .ep_api_version = 1, + .entry_point = &infrared_cli_start_ir, +}; + +const FlipperAppPluginDescriptor* infrared_cli_plugin_ep() { + return &plugin_descriptor; } diff --git a/applications/main/infrared/infrared_start.c b/applications/main/infrared/infrared_start.c new file mode 100644 index 000000000..9e4a82026 --- /dev/null +++ b/applications/main/infrared/infrared_start.c @@ -0,0 +1,11 @@ +#include + +static void infrared_cli_start_ir_wrapper(Cli* cli, FuriString* args, void* context) { + cli_plugin_wrapper("infrared_cli", 1, cli, args, context); +} + +void infrared_on_system_start() { + Cli* cli = (Cli*)furi_record_open(RECORD_CLI); + cli_add_command(cli, "ir", CliCommandFlagDefault, infrared_cli_start_ir_wrapper, NULL); + furi_record_close(RECORD_CLI); +} diff --git a/applications/main/lfrfid/application.fam b/applications/main/lfrfid/application.fam index f8d062f36..5e97e925d 100644 --- a/applications/main/lfrfid/application.fam +++ b/applications/main/lfrfid/application.fam @@ -11,11 +11,20 @@ App( fap_category="RFID", ) +App( + appid="lfrfid_cli", + targets=["f7"], + apptype=FlipperAppType.PLUGIN, + entry_point="lfrfid_cli_plugin_ep", + requires=["cli"], + sources=["lfrfid_cli.c"], +) + App( appid="lfrfid_start", targets=["f7"], apptype=FlipperAppType.STARTUP, entry_point="lfrfid_on_system_start", - sources=["lfrfid_cli.c"], + sources=["lfrfid_start.c"], order=50, ) diff --git a/applications/main/lfrfid/lfrfid_cli.c b/applications/main/lfrfid/lfrfid_cli.c index af340008a..5af1f6abe 100644 --- a/applications/main/lfrfid/lfrfid_cli.c +++ b/applications/main/lfrfid/lfrfid_cli.c @@ -14,15 +14,6 @@ #include #include -static void lfrfid_cli(Cli* cli, FuriString* args, void* context); - -// app cli function -void lfrfid_on_system_start() { - Cli* cli = furi_record_open(RECORD_CLI); - cli_add_command(cli, "rfid", CliCommandFlagDefault, lfrfid_cli, NULL); - furi_record_close(RECORD_CLI); -} - static void lfrfid_cli_print_usage() { printf("Usage:\r\n"); printf("rfid read - read in ASK/PSK mode\r\n"); @@ -577,3 +568,15 @@ static void lfrfid_cli(Cli* cli, FuriString* args, void* context) { furi_string_free(cmd); } + +#include + +static const FlipperAppPluginDescriptor plugin_descriptor = { + .appid = "lfrfid_cli", + .ep_api_version = 1, + .entry_point = &lfrfid_cli, +}; + +const FlipperAppPluginDescriptor* lfrfid_cli_plugin_ep() { + return &plugin_descriptor; +} diff --git a/applications/main/lfrfid/lfrfid_start.c b/applications/main/lfrfid/lfrfid_start.c new file mode 100644 index 000000000..1ed88d2f0 --- /dev/null +++ b/applications/main/lfrfid/lfrfid_start.c @@ -0,0 +1,11 @@ +#include + +static void lfrfid_cli_wrapper(Cli* cli, FuriString* args, void* context) { + cli_plugin_wrapper("lfrfid_cli", 1, cli, args, context); +} + +void lfrfid_on_system_start() { + Cli* cli = furi_record_open(RECORD_CLI); + cli_add_command(cli, "rfid", CliCommandFlagDefault, lfrfid_cli_wrapper, NULL); + furi_record_close(RECORD_CLI); +} diff --git a/applications/main/nfc/application.fam b/applications/main/nfc/application.fam index 0468e4bfb..10c288f24 100644 --- a/applications/main/nfc/application.fam +++ b/applications/main/nfc/application.fam @@ -263,11 +263,20 @@ App( sources=["plugins/supported_cards/sonicare.c"], ) +App( + appid="nfc_cli", + targets=["f7"], + apptype=FlipperAppType.PLUGIN, + entry_point="nfc_cli_plugin_ep", + requires=["cli"], + sources=["nfc_cli.c"], +) + App( appid="nfc_start", targets=["f7"], apptype=FlipperAppType.STARTUP, entry_point="nfc_on_system_start", - sources=["nfc_cli.c"], + sources=["nfc_start.c"], order=30, ) diff --git a/applications/main/nfc/nfc_cli.c b/applications/main/nfc/nfc_cli.c index b5a40b122..85cc2ae84 100644 --- a/applications/main/nfc/nfc_cli.c +++ b/applications/main/nfc/nfc_cli.c @@ -63,12 +63,14 @@ static void nfc_cli(Cli* cli, FuriString* args, void* context) { furi_string_free(cmd); } -void nfc_on_system_start() { -#ifdef SRV_CLI - Cli* cli = furi_record_open(RECORD_CLI); - cli_add_command(cli, "nfc", CliCommandFlagDefault, nfc_cli, NULL); - furi_record_close(RECORD_CLI); -#else - UNUSED(nfc_cli); -#endif +#include + +static const FlipperAppPluginDescriptor plugin_descriptor = { + .appid = "nfc_cli", + .ep_api_version = 1, + .entry_point = &nfc_cli, +}; + +const FlipperAppPluginDescriptor* nfc_cli_plugin_ep() { + return &plugin_descriptor; } diff --git a/applications/main/nfc/nfc_start.c b/applications/main/nfc/nfc_start.c new file mode 100644 index 000000000..6e5b5a8b2 --- /dev/null +++ b/applications/main/nfc/nfc_start.c @@ -0,0 +1,11 @@ +#include + +static void nfc_cli_wrapper(Cli* cli, FuriString* args, void* context) { + cli_plugin_wrapper("nfc_cli", 1, cli, args, context); +} + +void nfc_on_system_start() { + Cli* cli = furi_record_open(RECORD_CLI); + cli_add_command(cli, "nfc", CliCommandFlagDefault, nfc_cli_wrapper, NULL); + furi_record_close(RECORD_CLI); +} diff --git a/applications/main/onewire/application.fam b/applications/main/onewire/application.fam index 3d35abce9..9fac2ff21 100644 --- a/applications/main/onewire/application.fam +++ b/applications/main/onewire/application.fam @@ -1,6 +1,16 @@ +App( + appid="onewire_cli", + targets=["f7"], + apptype=FlipperAppType.PLUGIN, + entry_point="onewire_cli_plugin_ep", + requires=["cli"], + sources=["onewire_cli.c"], +) + App( appid="onewire_start", apptype=FlipperAppType.STARTUP, entry_point="onewire_on_system_start", + sources=["onewire_start.c"], order=60, ) diff --git a/applications/main/onewire/onewire_cli.c b/applications/main/onewire/onewire_cli.c index 9a7ffe55c..7fb01bef0 100644 --- a/applications/main/onewire/onewire_cli.c +++ b/applications/main/onewire/onewire_cli.c @@ -6,18 +6,6 @@ #include -static void onewire_cli(Cli* cli, FuriString* args, void* context); - -void onewire_on_system_start() { -#ifdef SRV_CLI - Cli* cli = furi_record_open(RECORD_CLI); - cli_add_command(cli, "onewire", CliCommandFlagDefault, onewire_cli, cli); - furi_record_close(RECORD_CLI); -#else - UNUSED(onewire_cli); -#endif -} - static void onewire_cli_print_usage() { printf("Usage:\r\n"); printf("onewire search\r\n"); @@ -70,3 +58,15 @@ void onewire_cli(Cli* cli, FuriString* args, void* context) { furi_string_free(cmd); } + +#include + +static const FlipperAppPluginDescriptor plugin_descriptor = { + .appid = "onewire_cli", + .ep_api_version = 1, + .entry_point = &onewire_cli, +}; + +const FlipperAppPluginDescriptor* onewire_cli_plugin_ep() { + return &plugin_descriptor; +} diff --git a/applications/main/onewire/onewire_start.c b/applications/main/onewire/onewire_start.c new file mode 100644 index 000000000..6249204ab --- /dev/null +++ b/applications/main/onewire/onewire_start.c @@ -0,0 +1,11 @@ +#include + +static void onewire_cli_wrapper(Cli* cli, FuriString* args, void* context) { + cli_plugin_wrapper("onewire_cli", 1, cli, args, context); +} + +void onewire_on_system_start() { + Cli* cli = furi_record_open(RECORD_CLI); + cli_add_command(cli, "onewire", CliCommandFlagDefault, onewire_cli_wrapper, cli); + furi_record_close(RECORD_CLI); +} diff --git a/applications/main/subghz/application.fam b/applications/main/subghz/application.fam index b7c768bd2..8fb501c72 100644 --- a/applications/main/subghz/application.fam +++ b/applications/main/subghz/application.fam @@ -32,13 +32,22 @@ App( fap_category="Sub-GHz", ) +App( + appid="subghz_cli", + targets=["f7"], + apptype=FlipperAppType.PLUGIN, + entry_point="subghz_cli_plugin_ep", + requires=["cli"], + sources=["subghz_cli.c", "helpers/subghz_chat.c"], +) + App( appid="subghz_start", targets=["f7"], apptype=FlipperAppType.STARTUP, entry_point="subghz_on_system_start", - # sources=["subghz_cli.c", "helpers/subghz_chat.c"], + # sources=["subghz_start.c"], order=40, ) diff --git a/applications/main/subghz/subghz_cli.c b/applications/main/subghz/subghz_cli.c index f84d59983..15a890080 100644 --- a/applications/main/subghz/subghz_cli.c +++ b/applications/main/subghz/subghz_cli.c @@ -1197,17 +1197,14 @@ static void subghz_cli_command(Cli* cli, FuriString* args, void* context) { furi_string_free(cmd); } -void subghz_on_system_start() { -#ifdef SRV_CLI - Cli* cli = furi_record_open(RECORD_CLI); +#include - cli_add_command(cli, "subghz", CliCommandFlagDefault, subghz_cli_command, NULL); +static const FlipperAppPluginDescriptor plugin_descriptor = { + .appid = "subghz_cli", + .ep_api_version = 1, + .entry_point = &subghz_cli_command, +}; - // psst RM... i know you dont care much about errors, but if you ever see this... incompatible pointer type :3 - cli_add_command(cli, "chat", CliCommandFlagDefault, subghz_cli_command_chat, NULL); - - furi_record_close(RECORD_CLI); -#else - UNUSED(subghz_cli_command); -#endif +const FlipperAppPluginDescriptor* subghz_cli_plugin_ep() { + return &plugin_descriptor; } diff --git a/applications/main/subghz/subghz_start.c b/applications/main/subghz/subghz_start.c new file mode 100644 index 000000000..1cabcb5e6 --- /dev/null +++ b/applications/main/subghz/subghz_start.c @@ -0,0 +1,17 @@ +#include + +static void subghz_cli_command_wrapper(Cli* cli, FuriString* args, void* context) { + cli_plugin_wrapper("subghz_cli", 1, cli, args, context); +} + +static void subghz_cli_command_chat_wrapper(Cli* cli, FuriString* args, void* context) { + furi_string_replace_at(args, 0, 0, "chat "); + subghz_cli_command_wrapper(cli, args, context); +} + +void subghz_on_system_start() { + Cli* cli = furi_record_open(RECORD_CLI); + cli_add_command(cli, "subghz", CliCommandFlagDefault, subghz_cli_command_wrapper, NULL); + cli_add_command(cli, "chat", CliCommandFlagDefault, subghz_cli_command_chat_wrapper, NULL); + furi_record_close(RECORD_CLI); +} diff --git a/applications/services/bt/application.fam b/applications/services/bt/application.fam index d871029de..1ef59bd49 100644 --- a/applications/services/bt/application.fam +++ b/applications/services/bt/application.fam @@ -17,6 +17,15 @@ App( sdk_headers=["bt_service/bt.h", "bt_settings.h"], ) +App( + appid="bt_cli", + targets=["f7"], + apptype=FlipperAppType.PLUGIN, + entry_point="bt_cli_plugin_ep", + requires=["cli"], + sources=["bt_cli.c"], +) + App( appid="bt_start", apptype=FlipperAppType.STARTUP, diff --git a/applications/services/bt/bt_cli.c b/applications/services/bt/bt_cli.c index e8ba215bf..2e078ca7f 100644 --- a/applications/services/bt/bt_cli.c +++ b/applications/services/bt/bt_cli.c @@ -227,12 +227,14 @@ static void bt_cli(Cli* cli, FuriString* args, void* context) { furi_record_close(RECORD_BT); } -void bt_on_system_start() { -#ifdef SRV_CLI - Cli* cli = furi_record_open(RECORD_CLI); - cli_add_command(cli, RECORD_BT, CliCommandFlagDefault, bt_cli, NULL); - furi_record_close(RECORD_CLI); -#else - UNUSED(bt_cli); -#endif +#include + +static const FlipperAppPluginDescriptor plugin_descriptor = { + .appid = "bt_cli", + .ep_api_version = 1, + .entry_point = &bt_cli, +}; + +const FlipperAppPluginDescriptor* bt_cli_plugin_ep() { + return &plugin_descriptor; } diff --git a/applications/services/bt/bt_start.c b/applications/services/bt/bt_start.c new file mode 100644 index 000000000..52b98825d --- /dev/null +++ b/applications/services/bt/bt_start.c @@ -0,0 +1,12 @@ +#include +#include "bt_service/bt.h" + +static void bt_cli_wrapper(Cli* cli, FuriString* args, void* context) { + cli_plugin_wrapper("bt_cli", 1, cli, args, context); +} + +void bt_on_system_start() { + Cli* cli = furi_record_open(RECORD_CLI); + cli_add_command(cli, RECORD_BT, CliCommandFlagDefault, bt_cli_wrapper, NULL); + furi_record_close(RECORD_CLI); +} diff --git a/applications/services/cli/cli.c b/applications/services/cli/cli.c index e1e32222a..26e204a4c 100644 --- a/applications/services/cli/cli.c +++ b/applications/services/cli/cli.c @@ -4,6 +4,10 @@ #include #include +#include +#include +#include + #define TAG "CliSrv" #define CLI_INPUT_LEN_LIMIT 256 @@ -481,3 +485,58 @@ int32_t cli_srv(void* p) { return 0; } + +void cli_plugin_wrapper( + const char* handler_name, + uint32_t handler_version, + Cli* cli, + FuriString* args, + void* context) { + Storage* storage = furi_record_open(RECORD_STORAGE); + FlipperApplication* plugin_app = flipper_application_alloc(storage, firmware_api_interface); + do { + FuriString* full_handler_path = + furi_string_alloc_printf(EXT_PATH("apps_data/cli/plugins/%s.fal"), handler_name); + FlipperApplicationPreloadStatus preload_res = + flipper_application_preload(plugin_app, furi_string_get_cstr(full_handler_path)); + furi_string_free(full_handler_path); + + if(preload_res != FlipperApplicationPreloadStatusSuccess) { + printf("Failed to preload CLI plugin. Code: %d\r\n", preload_res); + break; + } + + if(!flipper_application_is_plugin(plugin_app)) { + printf("CLI plugin file is not a library\r\n"); + break; + } + + FlipperApplicationLoadStatus load_status = flipper_application_map_to_memory(plugin_app); + if(load_status != FlipperApplicationLoadStatusSuccess) { + printf("Failed to load CLI plugin file. Code %d\r\n", load_status); + break; + } + + const FlipperAppPluginDescriptor* app_descriptor = + flipper_application_plugin_get_descriptor(plugin_app); + + if(strcmp(app_descriptor->appid, handler_name) != 0) { + printf("CLI plugin type doesn't match\r\n"); + break; + } + + if(app_descriptor->ep_api_version != handler_version) { + printf( + "CLI plugin version %" PRIu32 " doesn't match\r\n", + app_descriptor->ep_api_version); + break; + } + + const CliCallback handler = app_descriptor->entry_point; + + handler(cli, args, context); + + } while(false); + flipper_application_free(plugin_app); + furi_record_close(RECORD_STORAGE); +} diff --git a/applications/services/cli/cli_i.h b/applications/services/cli/cli_i.h index 858cd0c8f..cd0e50740 100644 --- a/applications/services/cli/cli_i.h +++ b/applications/services/cli/cli_i.h @@ -62,6 +62,16 @@ void cli_putc(Cli* cli, char c); void cli_stdout_callback(void* _cookie, const char* data, size_t size); +// Wraps CLI commands to load from plugin file +// Must call from CLI context, like dummy CLI command callback +// You need to setup the plugin to compile correctly separately +void cli_plugin_wrapper( + const char* handler_name, + uint32_t handler_version, + Cli* cli, + FuriString* args, + void* context); + #ifdef __cplusplus } #endif \ No newline at end of file diff --git a/applications/services/crypto/application.fam b/applications/services/crypto/application.fam index 7771c5ed2..9a45c27db 100644 --- a/applications/services/crypto/application.fam +++ b/applications/services/crypto/application.fam @@ -1,6 +1,16 @@ +App( + appid="crypto_cli", + targets=["f7"], + apptype=FlipperAppType.PLUGIN, + entry_point="crypto_cli_plugin_ep", + requires=["cli"], + sources=["crypto_cli.c"], +) + App( appid="crypto_start", apptype=FlipperAppType.STARTUP, entry_point="crypto_on_system_start", + sources=["crypto_start.c"], order=10, ) diff --git a/applications/services/crypto/crypto_cli.c b/applications/services/crypto/crypto_cli.c index 128ee636b..1d55aca12 100644 --- a/applications/services/crypto/crypto_cli.c +++ b/applications/services/crypto/crypto_cli.c @@ -316,12 +316,14 @@ static void crypto_cli(Cli* cli, FuriString* args, void* context) { furi_string_free(cmd); } -void crypto_on_system_start() { -#ifdef SRV_CLI - Cli* cli = furi_record_open(RECORD_CLI); - cli_add_command(cli, "crypto", CliCommandFlagDefault, crypto_cli, NULL); - furi_record_close(RECORD_CLI); -#else - UNUSED(crypto_cli); -#endif +#include + +static const FlipperAppPluginDescriptor plugin_descriptor = { + .appid = "crypto_cli", + .ep_api_version = 1, + .entry_point = &crypto_cli, +}; + +const FlipperAppPluginDescriptor* crypto_cli_plugin_ep() { + return &plugin_descriptor; } diff --git a/applications/services/crypto/crypto_start.c b/applications/services/crypto/crypto_start.c new file mode 100644 index 000000000..f78bc9df0 --- /dev/null +++ b/applications/services/crypto/crypto_start.c @@ -0,0 +1,11 @@ +#include + +static void crypto_cli_wrapper(Cli* cli, FuriString* args, void* context) { + cli_plugin_wrapper("crypto_cli", 1, cli, args, context); +} + +void crypto_on_system_start() { + Cli* cli = furi_record_open(RECORD_CLI); + cli_add_command(cli, "crypto", CliCommandFlagDefault, crypto_cli_wrapper, NULL); + furi_record_close(RECORD_CLI); +} diff --git a/applications/services/input/application.fam b/applications/services/input/application.fam index d344fc350..f4df7c109 100644 --- a/applications/services/input/application.fam +++ b/applications/services/input/application.fam @@ -8,3 +8,12 @@ App( order=80, sdk_headers=["input.h"], ) + +App( + appid="input_cli", + targets=["f7"], + apptype=FlipperAppType.PLUGIN, + entry_point="input_cli_plugin_ep", + requires=["cli"], + sources=["input_cli.c"], +) diff --git a/applications/services/input/input.c b/applications/services/input/input.c index 5f5872504..105fac008 100644 --- a/applications/services/input/input.c +++ b/applications/services/input/input.c @@ -54,6 +54,12 @@ const char* input_get_type_name(InputType type) { } } +#include + +static void input_cli_wrapper(Cli* cli, FuriString* args, void* context) { + cli_plugin_wrapper("input_cli", 1, cli, args, context); +} + int32_t input_srv(void* p) { UNUSED(p); input = malloc(sizeof(Input)); @@ -69,7 +75,9 @@ int32_t input_srv(void* p) { #ifdef SRV_CLI input->cli = furi_record_open(RECORD_CLI); - cli_add_command(input->cli, "input", CliCommandFlagParallelSafe, input_cli, input); + cli_add_command(input->cli, "input", CliCommandFlagParallelSafe, input_cli_wrapper, input); +#else + UNUSED(input_cli_wrapper); #endif input->pin_states = malloc(input_pins_count * sizeof(InputPinState)); diff --git a/applications/services/input/input_cli.c b/applications/services/input/input_cli.c index c625532e3..007b104b3 100644 --- a/applications/services/input/input_cli.c +++ b/applications/services/input/input_cli.c @@ -222,3 +222,15 @@ void input_cli(Cli* cli, FuriString* args, void* context) { furi_string_free(cmd); } + +#include + +static const FlipperAppPluginDescriptor plugin_descriptor = { + .appid = "input_cli", + .ep_api_version = 1, + .entry_point = &input_cli, +}; + +const FlipperAppPluginDescriptor* input_cli_plugin_ep() { + return &plugin_descriptor; +} diff --git a/applications/services/loader/application.fam b/applications/services/loader/application.fam index f4d006e07..b3035dee4 100644 --- a/applications/services/loader/application.fam +++ b/applications/services/loader/application.fam @@ -14,6 +14,15 @@ App( ], ) +App( + appid="loader_cli", + targets=["f7"], + apptype=FlipperAppType.PLUGIN, + entry_point="loader_cli_plugin_ep", + requires=["cli"], + sources=["loader_cli.c"], +) + App( appid="loader_start", apptype=FlipperAppType.STARTUP, diff --git a/applications/services/loader/loader_cli.c b/applications/services/loader/loader_cli.c index 17f0319e2..775e36536 100644 --- a/applications/services/loader/loader_cli.c +++ b/applications/services/loader/loader_cli.c @@ -104,12 +104,14 @@ static void loader_cli(Cli* cli, FuriString* args, void* context) { furi_record_close(RECORD_LOADER); } -void loader_on_system_start() { -#ifdef SRV_CLI - Cli* cli = furi_record_open(RECORD_CLI); - cli_add_command(cli, RECORD_LOADER, CliCommandFlagParallelSafe, loader_cli, NULL); - furi_record_close(RECORD_CLI); -#else - UNUSED(loader_cli); -#endif +#include + +static const FlipperAppPluginDescriptor plugin_descriptor = { + .appid = "loader_cli", + .ep_api_version = 1, + .entry_point = &loader_cli, +}; + +const FlipperAppPluginDescriptor* loader_cli_plugin_ep() { + return &plugin_descriptor; } diff --git a/applications/services/loader/loader_start.c b/applications/services/loader/loader_start.c new file mode 100644 index 000000000..7e47099d9 --- /dev/null +++ b/applications/services/loader/loader_start.c @@ -0,0 +1,12 @@ +#include +#include "loader.h" + +static void loader_cli_wrapper(Cli* cli, FuriString* args, void* context) { + cli_plugin_wrapper("loader_cli", 1, cli, args, context); +} + +void loader_on_system_start() { + Cli* cli = furi_record_open(RECORD_CLI); + cli_add_command(cli, RECORD_LOADER, CliCommandFlagParallelSafe, loader_cli_wrapper, NULL); + furi_record_close(RECORD_CLI); +} diff --git a/applications/services/power/application.fam b/applications/services/power/application.fam index d390ab965..6514e41b3 100644 --- a/applications/services/power/application.fam +++ b/applications/services/power/application.fam @@ -17,6 +17,15 @@ App( sdk_headers=["power_service/power.h", "power_settings.h"], ) +App( + appid="power_cli", + targets=["f7"], + apptype=FlipperAppType.PLUGIN, + entry_point="power_cli_plugin_ep", + requires=["cli"], + sources=["power_cli.c"], +) + App( appid="power_start", apptype=FlipperAppType.STARTUP, diff --git a/applications/services/power/power_cli.c b/applications/services/power/power_cli.c index 021ce3553..2e7dabc79 100644 --- a/applications/services/power/power_cli.c +++ b/applications/services/power/power_cli.c @@ -106,14 +106,14 @@ void power_cli(Cli* cli, FuriString* args, void* context) { furi_string_free(cmd); } -void power_on_system_start() { -#ifdef SRV_CLI - Cli* cli = furi_record_open(RECORD_CLI); +#include - cli_add_command(cli, "power", CliCommandFlagParallelSafe, power_cli, NULL); +static const FlipperAppPluginDescriptor plugin_descriptor = { + .appid = "power_cli", + .ep_api_version = 1, + .entry_point = &power_cli, +}; - furi_record_close(RECORD_CLI); -#else - UNUSED(power_cli); -#endif +const FlipperAppPluginDescriptor* power_cli_plugin_ep() { + return &plugin_descriptor; } diff --git a/applications/services/power/power_start.c b/applications/services/power/power_start.c new file mode 100644 index 000000000..3ddb5ba78 --- /dev/null +++ b/applications/services/power/power_start.c @@ -0,0 +1,11 @@ +#include + +static void power_cli_wrapper(Cli* cli, FuriString* args, void* context) { + cli_plugin_wrapper("power_cli", 1, cli, args, context); +} + +void power_on_system_start() { + Cli* cli = furi_record_open(RECORD_CLI); + cli_add_command(cli, "power", CliCommandFlagParallelSafe, power_cli_wrapper, NULL); + furi_record_close(RECORD_CLI); +} diff --git a/lib/subghz/protocols/faac_slh.h b/lib/subghz/protocols/faac_slh.h index 1f0dadf69..b6ea07c63 100644 --- a/lib/subghz/protocols/faac_slh.h +++ b/lib/subghz/protocols/faac_slh.h @@ -107,7 +107,3 @@ SubGhzProtocolStatus * @param output Resulting text */ void subghz_protocol_decoder_faac_slh_get_string(void* context, FuriString* output); - -// Reset prog mode vars -// TODO: Remake in proper way -void faac_slh_reset_prog_mode(); \ No newline at end of file diff --git a/lib/subghz/protocols/public_api.h b/lib/subghz/protocols/public_api.h index d7ae21c2a..37f3521f4 100644 --- a/lib/subghz/protocols/public_api.h +++ b/lib/subghz/protocols/public_api.h @@ -212,6 +212,10 @@ void subghz_protocol_decoder_bin_raw_data_input_rssi( */ bool subghz_protocol_secplus_v1_check_fixed(uint32_t fixed); +// Reset prog mode vars +// TODO: Remake in proper way +void faac_slh_reset_prog_mode(); + #ifdef __cplusplus } #endif diff --git a/targets/f7/api_symbols.csv b/targets/f7/api_symbols.csv index 5d17f0680..5e9783b1f 100644 --- a/targets/f7/api_symbols.csv +++ b/targets/f7/api_symbols.csv @@ -1043,6 +1043,7 @@ Function,-,explicit_bzero,void,"void*, size_t" Function,-,expm1,double,double Function,-,expm1f,float,float Function,-,expm1l,long double,long double +Function,+,faac_slh_reset_prog_mode,void, Function,-,fabs,double,double Function,-,fabsf,float,float Function,-,fabsl,long double,long double @@ -3355,14 +3356,14 @@ Function,+,subghz_file_encoder_worker_get_text_progress,void,"SubGhzFileEncoderW Function,+,subghz_file_encoder_worker_is_running,_Bool,SubGhzFileEncoderWorker* Function,+,subghz_file_encoder_worker_start,_Bool,"SubGhzFileEncoderWorker*, const char*, const char*" Function,+,subghz_file_encoder_worker_stop,void,SubGhzFileEncoderWorker* -Function,-,subghz_keystore_alloc,SubGhzKeystore*, -Function,-,subghz_keystore_free,void,SubGhzKeystore* +Function,+,subghz_keystore_alloc,SubGhzKeystore*, +Function,+,subghz_keystore_free,void,SubGhzKeystore* Function,-,subghz_keystore_get_data,SubGhzKeyArray_t*,SubGhzKeystore* -Function,-,subghz_keystore_load,_Bool,"SubGhzKeystore*, const char*" -Function,-,subghz_keystore_raw_encrypted_save,_Bool,"const char*, const char*, uint8_t*" +Function,+,subghz_keystore_load,_Bool,"SubGhzKeystore*, const char*" +Function,+,subghz_keystore_raw_encrypted_save,_Bool,"const char*, const char*, uint8_t*" Function,-,subghz_keystore_raw_get_data,_Bool,"const char*, size_t, uint8_t*, size_t" Function,-,subghz_keystore_reset_kl,void,SubGhzKeystore* -Function,-,subghz_keystore_save,_Bool,"SubGhzKeystore*, const char*, uint8_t*" +Function,+,subghz_keystore_save,_Bool,"SubGhzKeystore*, const char*, uint8_t*" Function,+,subghz_protocol_alutech_at_4n_create_data,_Bool,"void*, FlipperFormat*, uint32_t, uint8_t, uint16_t, SubGhzRadioPreset*" Function,+,subghz_protocol_blocks_add_bit,void,"SubGhzBlockDecoder*, uint8_t" Function,+,subghz_protocol_blocks_add_bytes,uint8_t,"const uint8_t[], size_t"