mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-12 20:08:36 -07:00
(Experimental) External CLI plugins -29kb DFU
Idea and plugin loader implementation by @akopachov, thanks! All commands done except storage and rpc for latency reasons
This commit is contained in:
@@ -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,
|
||||
)
|
||||
|
||||
@@ -8,19 +8,6 @@
|
||||
#include <ibutton/ibutton_worker.h>
|
||||
#include <ibutton/ibutton_protocols.h>
|
||||
|
||||
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 <flipper_application/flipper_application.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
11
applications/main/ibutton/ibutton_start.c
Normal file
11
applications/main/ibutton/ibutton_start.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <cli/cli_i.h>
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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 <flipper_application/flipper_application.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
11
applications/main/infrared/infrared_start.c
Normal file
11
applications/main/infrared/infrared_start.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <cli/cli_i.h>
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -14,15 +14,6 @@
|
||||
#include <lfrfid/lfrfid_raw_file.h>
|
||||
#include <toolbox/pulse_protocols/pulse_glue.h>
|
||||
|
||||
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 <optional: normal | indala> - 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 <flipper_application/flipper_application.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
11
applications/main/lfrfid/lfrfid_start.c
Normal file
11
applications/main/lfrfid/lfrfid_start.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <cli/cli_i.h>
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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 <flipper_application/flipper_application.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
11
applications/main/nfc/nfc_start.c
Normal file
11
applications/main/nfc/nfc_start.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <cli/cli_i.h>
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -6,18 +6,6 @@
|
||||
|
||||
#include <one_wire/one_wire_host.h>
|
||||
|
||||
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 <flipper_application/flipper_application.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
11
applications/main/onewire/onewire_start.c
Normal file
11
applications/main/onewire/onewire_start.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <cli/cli_i.h>
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
@@ -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 <flipper_application/flipper_application.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
17
applications/main/subghz/subghz_start.c
Normal file
17
applications/main/subghz/subghz_start.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <cli/cli_i.h>
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -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 <flipper_application/flipper_application.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
12
applications/services/bt/bt_start.c
Normal file
12
applications/services/bt/bt_start.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <cli/cli_i.h>
|
||||
#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);
|
||||
}
|
||||
@@ -4,6 +4,10 @@
|
||||
#include <furi_hal_version.h>
|
||||
#include <loader/loader.h>
|
||||
|
||||
#include <flipper_application/flipper_application.h>
|
||||
#include <loader/firmware_api/firmware_api.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
@@ -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 <flipper_application/flipper_application.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
11
applications/services/crypto/crypto_start.c
Normal file
11
applications/services/crypto/crypto_start.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <cli/cli_i.h>
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -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"],
|
||||
)
|
||||
|
||||
@@ -54,6 +54,12 @@ const char* input_get_type_name(InputType type) {
|
||||
}
|
||||
}
|
||||
|
||||
#include <cli/cli_i.h>
|
||||
|
||||
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));
|
||||
|
||||
@@ -222,3 +222,15 @@ void input_cli(Cli* cli, FuriString* args, void* context) {
|
||||
|
||||
furi_string_free(cmd);
|
||||
}
|
||||
|
||||
#include <flipper_application/flipper_application.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 <flipper_application/flipper_application.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
12
applications/services/loader/loader_start.c
Normal file
12
applications/services/loader/loader_start.c
Normal file
@@ -0,0 +1,12 @@
|
||||
#include <cli/cli_i.h>
|
||||
#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);
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -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 <flipper_application/flipper_application.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
11
applications/services/power/power_start.c
Normal file
11
applications/services/power/power_start.c
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <cli/cli_i.h>
|
||||
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user