2020-11-16 13:16:34 +03:00
|
|
|
#include "cli_commands.h"
|
2022-06-10 00:04:36 +09:00
|
|
|
#include "cli_command_gpio.h"
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
#include "cli_ansi.h"
|
|
|
|
|
#include "cli.h"
|
2022-06-10 00:04:36 +09:00
|
|
|
|
2024-02-16 11:20:45 +04:00
|
|
|
#include <core/thread.h>
|
2022-01-05 19:10:18 +03:00
|
|
|
#include <furi_hal.h>
|
|
|
|
|
#include <furi_hal_info.h>
|
|
|
|
|
#include <task_control_block.h>
|
2021-05-21 12:57:52 +03:00
|
|
|
#include <time.h>
|
2022-01-05 19:10:18 +03:00
|
|
|
#include <notification/notification_messages.h>
|
2024-10-17 22:57:10 +07:00
|
|
|
#include <notification/notification_app.h>
|
2022-03-17 04:49:36 -05:00
|
|
|
#include <loader/loader.h>
|
2022-11-12 17:46:04 +09:00
|
|
|
#include <lib/toolbox/args.h>
|
2024-09-05 20:02:42 +03:00
|
|
|
#include <lib/toolbox/strint.h>
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
#include <toolbox/pipe.h>
|
2021-07-02 03:58:31 +03:00
|
|
|
|
2021-12-17 16:24:37 +03:00
|
|
|
// Close to ISO, `date +'%Y-%m-%d %H:%M:%S %u'`
|
|
|
|
|
#define CLI_DATE_FORMAT "%.4d-%.2d-%.2d %.2d:%.2d:%.2d %d"
|
|
|
|
|
|
2023-02-26 14:28:52 +02:00
|
|
|
void cli_command_info_callback(const char* key, const char* value, bool last, void* context) {
|
2022-05-06 16:37:10 +03:00
|
|
|
UNUSED(last);
|
2023-02-26 14:28:52 +02:00
|
|
|
UNUSED(context);
|
2022-08-11 18:21:56 +09:00
|
|
|
printf("%-30s: %s\r\n", key, value);
|
2021-12-07 16:47:20 +03:00
|
|
|
}
|
2021-09-15 12:59:49 +03:00
|
|
|
|
2023-02-26 14:28:52 +02:00
|
|
|
/** Info Command
|
|
|
|
|
*
|
2021-12-07 16:47:20 +03:00
|
|
|
* This command is intended to be used by humans
|
2023-02-26 14:28:52 +02:00
|
|
|
*
|
|
|
|
|
* Arguments:
|
|
|
|
|
* - device - print device info
|
|
|
|
|
* - power - print power info
|
|
|
|
|
* - power_debug - print power debug info
|
|
|
|
|
*
|
|
|
|
|
* @param cli The cli instance
|
|
|
|
|
* @param args The arguments
|
|
|
|
|
* @param context The context
|
2021-07-02 03:58:31 +03:00
|
|
|
*/
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
void cli_command_info(PipeSide* pipe, FuriString* args, void* context) {
|
|
|
|
|
UNUSED(pipe);
|
2023-02-26 14:28:52 +02:00
|
|
|
|
|
|
|
|
if(context) {
|
|
|
|
|
furi_hal_info_get(cli_command_info_callback, '_', NULL);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!furi_string_cmp(args, "device")) {
|
|
|
|
|
furi_hal_info_get(cli_command_info_callback, '.', NULL);
|
|
|
|
|
} else if(!furi_string_cmp(args, "power")) {
|
|
|
|
|
furi_hal_power_info_get(cli_command_info_callback, '.', NULL);
|
|
|
|
|
} else if(!furi_string_cmp(args, "power_debug")) {
|
|
|
|
|
furi_hal_power_debug_get(cli_command_info_callback, NULL);
|
|
|
|
|
} else {
|
|
|
|
|
cli_print_usage("info", "<device|power|power_debug>", furi_string_get_cstr(args));
|
|
|
|
|
}
|
2021-07-02 03:58:31 +03:00
|
|
|
}
|
2020-11-16 13:16:34 +03:00
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
void cli_command_help(PipeSide* pipe, FuriString* args, void* context) {
|
|
|
|
|
UNUSED(pipe);
|
2024-10-17 19:12:27 +03:00
|
|
|
UNUSED(args);
|
2024-10-14 17:50:18 +03:00
|
|
|
UNUSED(context);
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
printf("Available commands:" ANSI_FG_GREEN);
|
|
|
|
|
|
|
|
|
|
// count non-hidden commands
|
|
|
|
|
Cli* cli = furi_record_open(RECORD_CLI);
|
|
|
|
|
cli_lock_commands(cli);
|
|
|
|
|
CliCommandTree_t* commands = cli_get_commands(cli);
|
|
|
|
|
size_t commands_count = CliCommandTree_size(*commands);
|
|
|
|
|
|
|
|
|
|
// create iterators starting at different positions
|
|
|
|
|
const size_t columns = 3;
|
|
|
|
|
const size_t commands_per_column = (commands_count / columns) + (commands_count % columns);
|
|
|
|
|
CliCommandTree_it_t iterators[columns];
|
|
|
|
|
for(size_t c = 0; c < columns; c++) {
|
|
|
|
|
CliCommandTree_it(iterators[c], *commands);
|
|
|
|
|
for(size_t i = 0; i < c * commands_per_column; i++)
|
|
|
|
|
CliCommandTree_next(iterators[c]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// print commands
|
|
|
|
|
for(size_t r = 0; r < commands_per_column; r++) {
|
2021-05-18 12:30:04 +03:00
|
|
|
printf("\r\n");
|
2020-11-16 13:16:34 +03:00
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
for(size_t c = 0; c < columns; c++) {
|
|
|
|
|
if(!CliCommandTree_end_p(iterators[c])) {
|
|
|
|
|
const CliCommandTree_itref_t* item = CliCommandTree_cref(iterators[c]);
|
|
|
|
|
printf("%-30s", furi_string_get_cstr(*item->key_ptr));
|
|
|
|
|
CliCommandTree_next(iterators[c]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-11-16 13:16:34 +03:00
|
|
|
}
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
|
|
|
|
|
printf(ANSI_RESET "\r\nFind out more: https://docs.flipper.net/development/cli");
|
|
|
|
|
|
|
|
|
|
cli_unlock_commands(cli);
|
|
|
|
|
furi_record_close(RECORD_CLI);
|
2020-11-16 13:16:34 +03:00
|
|
|
}
|
|
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
void cli_command_uptime(PipeSide* pipe, FuriString* args, void* context) {
|
|
|
|
|
UNUSED(pipe);
|
2023-07-13 15:02:08 +04:00
|
|
|
UNUSED(args);
|
|
|
|
|
UNUSED(context);
|
|
|
|
|
uint32_t uptime = furi_get_tick() / furi_kernel_get_tick_frequency();
|
|
|
|
|
printf("Uptime: %luh%lum%lus", uptime / 60 / 60, uptime / 60 % 60, uptime % 60);
|
|
|
|
|
}
|
|
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
void cli_command_date(PipeSide* pipe, FuriString* args, void* context) {
|
|
|
|
|
UNUSED(pipe);
|
2022-05-06 16:37:10 +03:00
|
|
|
UNUSED(context);
|
|
|
|
|
|
2024-02-15 12:44:41 +09:00
|
|
|
DateTime datetime = {0};
|
2020-11-23 16:26:19 +03:00
|
|
|
|
2022-10-06 01:15:23 +10:00
|
|
|
if(furi_string_size(args) > 0) {
|
2021-12-15 01:39:59 +03:00
|
|
|
uint16_t hours, minutes, seconds, month, day, year, weekday;
|
2021-06-23 23:06:57 +03:00
|
|
|
int ret = sscanf(
|
2022-10-06 01:15:23 +10:00
|
|
|
furi_string_get_cstr(args),
|
2021-12-17 16:24:37 +03:00
|
|
|
"%hu-%hu-%hu %hu:%hu:%hu %hu",
|
|
|
|
|
&year,
|
|
|
|
|
&month,
|
|
|
|
|
&day,
|
2021-12-15 01:39:59 +03:00
|
|
|
&hours,
|
|
|
|
|
&minutes,
|
|
|
|
|
&seconds,
|
|
|
|
|
&weekday);
|
2021-12-17 16:24:37 +03:00
|
|
|
|
|
|
|
|
// Some variables are going to discard upper byte
|
|
|
|
|
// There will be some funky behaviour which is not breaking anything
|
|
|
|
|
datetime.hour = hours;
|
|
|
|
|
datetime.minute = minutes;
|
|
|
|
|
datetime.second = seconds;
|
|
|
|
|
datetime.weekday = weekday;
|
|
|
|
|
datetime.month = month;
|
|
|
|
|
datetime.day = day;
|
|
|
|
|
datetime.year = year;
|
|
|
|
|
|
|
|
|
|
if(ret != 7) {
|
2021-06-23 23:06:57 +03:00
|
|
|
printf(
|
2021-12-17 16:24:37 +03:00
|
|
|
"Invalid datetime format, use `%s`. sscanf %d %s",
|
|
|
|
|
"%Y-%m-%d %H:%M:%S %u",
|
2021-06-23 23:06:57 +03:00
|
|
|
ret,
|
2022-10-06 01:15:23 +10:00
|
|
|
furi_string_get_cstr(args));
|
2021-06-23 23:06:57 +03:00
|
|
|
return;
|
|
|
|
|
}
|
2021-12-17 16:24:37 +03:00
|
|
|
|
2024-02-15 12:44:41 +09:00
|
|
|
if(!datetime_validate_datetime(&datetime)) {
|
2021-12-17 16:24:37 +03:00
|
|
|
printf("Invalid datetime data");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
furi_hal_rtc_set_datetime(&datetime);
|
|
|
|
|
// Verification
|
2021-12-15 01:39:59 +03:00
|
|
|
furi_hal_rtc_get_datetime(&datetime);
|
2021-06-23 23:06:57 +03:00
|
|
|
printf(
|
2021-12-17 16:24:37 +03:00
|
|
|
"New datetime is: " CLI_DATE_FORMAT,
|
|
|
|
|
datetime.year,
|
|
|
|
|
datetime.month,
|
|
|
|
|
datetime.day,
|
2021-12-15 01:39:59 +03:00
|
|
|
datetime.hour,
|
|
|
|
|
datetime.minute,
|
|
|
|
|
datetime.second,
|
2021-12-17 16:24:37 +03:00
|
|
|
datetime.weekday);
|
|
|
|
|
} else {
|
|
|
|
|
furi_hal_rtc_get_datetime(&datetime);
|
|
|
|
|
printf(
|
|
|
|
|
CLI_DATE_FORMAT,
|
|
|
|
|
datetime.year,
|
2021-12-15 01:39:59 +03:00
|
|
|
datetime.month,
|
|
|
|
|
datetime.day,
|
2021-12-17 16:24:37 +03:00
|
|
|
datetime.hour,
|
|
|
|
|
datetime.minute,
|
|
|
|
|
datetime.second,
|
2021-12-15 01:39:59 +03:00
|
|
|
datetime.weekday);
|
2021-06-23 23:06:57 +03:00
|
|
|
}
|
2020-11-23 16:26:19 +03:00
|
|
|
}
|
|
|
|
|
|
2024-07-15 07:38:49 +03:00
|
|
|
#define CLI_COMMAND_LOG_RING_SIZE 2048
|
2022-04-14 19:41:15 +03:00
|
|
|
#define CLI_COMMAND_LOG_BUFFER_SIZE 64
|
|
|
|
|
|
|
|
|
|
void cli_command_log_tx_callback(const uint8_t* buffer, size_t size, void* context) {
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
PipeSide* pipe = context;
|
|
|
|
|
pipe_send(pipe, buffer, size);
|
2022-04-14 19:41:15 +03:00
|
|
|
}
|
|
|
|
|
|
2023-07-11 14:41:16 +03:00
|
|
|
bool cli_command_log_level_set_from_string(FuriString* level) {
|
|
|
|
|
FuriLogLevel log_level;
|
|
|
|
|
if(furi_log_level_from_string(furi_string_get_cstr(level), &log_level)) {
|
|
|
|
|
furi_log_set_level(log_level);
|
|
|
|
|
return true;
|
2022-10-07 02:13:02 +10:00
|
|
|
} else {
|
2023-07-11 14:41:16 +03:00
|
|
|
printf("<log> — start logging using the current level from the system settings\r\n");
|
|
|
|
|
printf("<log error> — only critical errors and other important messages\r\n");
|
|
|
|
|
printf("<log warn> — non-critical errors and warnings including <log error>\r\n");
|
|
|
|
|
printf("<log info> — non-critical information including <log warn>\r\n");
|
|
|
|
|
printf("<log default> — the default system log level (equivalent to <log info>)\r\n");
|
|
|
|
|
printf(
|
|
|
|
|
"<log debug> — debug information including <log info> (may impact system performance)\r\n");
|
|
|
|
|
printf(
|
|
|
|
|
"<log trace> — system traces including <log debug> (may impact system performance)\r\n");
|
2022-10-07 02:13:02 +10:00
|
|
|
}
|
2023-07-11 14:41:16 +03:00
|
|
|
return false;
|
2022-10-07 02:13:02 +10:00
|
|
|
}
|
|
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
void cli_command_log(PipeSide* pipe, FuriString* args, void* context) {
|
2022-05-06 16:37:10 +03:00
|
|
|
UNUSED(context);
|
2022-10-07 02:13:02 +10:00
|
|
|
FuriLogLevel previous_level = furi_log_get_level();
|
|
|
|
|
bool restore_log_level = false;
|
|
|
|
|
|
|
|
|
|
if(furi_string_size(args) > 0) {
|
2023-07-11 14:41:16 +03:00
|
|
|
if(!cli_command_log_level_set_from_string(args)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2022-10-07 02:13:02 +10:00
|
|
|
restore_log_level = true;
|
|
|
|
|
}
|
2022-04-14 19:41:15 +03:00
|
|
|
|
2023-07-11 14:41:16 +03:00
|
|
|
const char* current_level;
|
|
|
|
|
furi_log_level_to_string(furi_log_get_level(), ¤t_level);
|
|
|
|
|
printf("Current log level: %s\r\n", current_level);
|
|
|
|
|
|
2024-01-16 08:09:37 +09:00
|
|
|
FuriLogHandler log_handler = {
|
|
|
|
|
.callback = cli_command_log_tx_callback,
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
.context = pipe,
|
2024-01-16 08:09:37 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
furi_log_add_handler(log_handler);
|
2022-04-14 19:41:15 +03:00
|
|
|
|
2023-07-11 14:41:16 +03:00
|
|
|
printf("Use <log ?> to list available log levels\r\n");
|
2022-04-14 19:41:15 +03:00
|
|
|
printf("Press CTRL+C to stop...\r\n");
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
while(!cli_is_pipe_broken_or_is_etx_next_char(pipe)) {
|
|
|
|
|
furi_delay_ms(100);
|
2022-04-14 19:41:15 +03:00
|
|
|
}
|
|
|
|
|
|
2024-01-16 08:09:37 +09:00
|
|
|
furi_log_remove_handler(log_handler);
|
2022-04-14 19:41:15 +03:00
|
|
|
|
2022-10-07 02:13:02 +10:00
|
|
|
if(restore_log_level) {
|
|
|
|
|
// There will be strange behaviour if log level is set from settings while log command is running
|
|
|
|
|
furi_log_set_level(previous_level);
|
|
|
|
|
}
|
[FL-781] FURI, CLI, stdlib: stdout hooks, integration between subsystems, uniform printf usage (#311)
* FURI stdglue: stdout hooks, local and global, ISR safe printf. Uniform newlines for terminal/debug output. Power: prevent sleep while core 2 has not started.
* Furi record, stdglue: check mutex allocation
* remove unused test
* Furi stdglue: buferized output, dynamically allocated state. Furi record: dynamically allocated state. Input dump: proper line ending. Hal VCP: dynamically allocated state.
* Interrupt manager: explicitly init list.
* Makefile: cleanup rules, fix broken dfu upload. F4: add compiler stack protection options.
* BLE: call debug uart callback on transmission complete
* FreeRTOS: add configUSE_NEWLIB_REENTRANT
* API HAL Timebase: fix issue with idle thread stack corruption caused by systick interrupt. BT: cleanup debug info output. FreeRTOS: disable reentry for newlib.
* F4: update stack protection CFLAGS to match used compiller
* F4: disable compiller stack protection because of incompatibility with current compiller
* Makefile: return openocd logs to gdb
* BLE: fixed pin, moar power, ble trace info.
* Prevent sleep when connection is active
* Makefile: return serial port to upload rule, add workaround for mac os
* Furi: prevent usage of stack for cmsis functions.
* F4: add missing includes, add debugger breakpoints
* Applications: per app stack size.
* Furi: honor kernel state in stdglue
* FreeRTOS: remove unused hooks
* Cleanup and format sources
Co-authored-by: DrZlo13 <who.just.the.doctor@gmail.com>
2021-01-29 03:09:33 +03:00
|
|
|
}
|
|
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
void cli_command_sysctl_debug(PipeSide* pipe, FuriString* args, void* context) {
|
|
|
|
|
UNUSED(pipe);
|
2022-05-06 16:37:10 +03:00
|
|
|
UNUSED(context);
|
2022-10-06 01:15:23 +10:00
|
|
|
if(!furi_string_cmp(args, "0")) {
|
2022-11-12 17:46:04 +09:00
|
|
|
furi_hal_rtc_reset_flag(FuriHalRtcFlagDebug);
|
|
|
|
|
printf("Debug disabled.");
|
2022-10-06 01:15:23 +10:00
|
|
|
} else if(!furi_string_cmp(args, "1")) {
|
2022-11-12 17:46:04 +09:00
|
|
|
furi_hal_rtc_set_flag(FuriHalRtcFlagDebug);
|
|
|
|
|
printf("Debug enabled.");
|
2021-03-08 18:48:14 +03:00
|
|
|
} else {
|
2022-11-12 17:46:04 +09:00
|
|
|
cli_print_usage("sysctl debug", "<1|0>", furi_string_get_cstr(args));
|
2021-03-08 18:48:14 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
void cli_command_sysctl_heap_track(PipeSide* pipe, FuriString* args, void* context) {
|
|
|
|
|
UNUSED(pipe);
|
2022-11-12 17:46:04 +09:00
|
|
|
UNUSED(context);
|
|
|
|
|
if(!furi_string_cmp(args, "none")) {
|
|
|
|
|
furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackModeNone);
|
|
|
|
|
printf("Heap tracking disabled");
|
|
|
|
|
} else if(!furi_string_cmp(args, "main")) {
|
|
|
|
|
furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackModeMain);
|
|
|
|
|
printf("Heap tracking enabled for application main thread");
|
2024-07-31 19:38:20 +03:00
|
|
|
#ifdef FURI_DEBUG
|
2022-11-12 17:46:04 +09:00
|
|
|
} else if(!furi_string_cmp(args, "tree")) {
|
|
|
|
|
furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackModeTree);
|
|
|
|
|
printf("Heap tracking enabled for application main and child threads");
|
|
|
|
|
} else if(!furi_string_cmp(args, "all")) {
|
|
|
|
|
furi_hal_rtc_set_heap_track_mode(FuriHalRtcHeapTrackModeAll);
|
|
|
|
|
printf("Heap tracking enabled for all threads");
|
|
|
|
|
#endif
|
|
|
|
|
} else {
|
|
|
|
|
cli_print_usage("sysctl heap_track", "<none|main|tree|all>", furi_string_get_cstr(args));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-19 23:43:52 +09:00
|
|
|
void cli_command_sysctl_print_usage(void) {
|
2022-11-12 17:46:04 +09:00
|
|
|
printf("Usage:\r\n");
|
|
|
|
|
printf("sysctl <cmd> <args>\r\n");
|
|
|
|
|
printf("Cmd list:\r\n");
|
|
|
|
|
|
|
|
|
|
printf("\tdebug <0|1>\t - Enable or disable system debug\r\n");
|
2024-07-31 19:38:20 +03:00
|
|
|
#ifdef FURI_DEBUG
|
2022-11-12 17:46:04 +09:00
|
|
|
printf("\theap_track <none|main|tree|all>\t - Set heap allocation tracking mode\r\n");
|
|
|
|
|
#else
|
|
|
|
|
printf("\theap_track <none|main>\t - Set heap allocation tracking mode\r\n");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
void cli_command_sysctl(PipeSide* pipe, FuriString* args, void* context) {
|
2022-11-12 17:46:04 +09:00
|
|
|
FuriString* cmd;
|
|
|
|
|
cmd = furi_string_alloc();
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
if(!args_read_string_and_trim(args, cmd)) {
|
|
|
|
|
cli_command_sysctl_print_usage();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(furi_string_cmp_str(cmd, "debug") == 0) {
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
cli_command_sysctl_debug(pipe, args, context);
|
2022-11-12 17:46:04 +09:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(furi_string_cmp_str(cmd, "heap_track") == 0) {
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
cli_command_sysctl_heap_track(pipe, args, context);
|
2022-11-12 17:46:04 +09:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cli_command_sysctl_print_usage();
|
|
|
|
|
} while(false);
|
|
|
|
|
|
|
|
|
|
furi_string_free(cmd);
|
|
|
|
|
}
|
|
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
void cli_command_vibro(PipeSide* pipe, FuriString* args, void* context) {
|
|
|
|
|
UNUSED(pipe);
|
2022-05-06 16:37:10 +03:00
|
|
|
UNUSED(context);
|
2024-10-17 22:57:10 +07:00
|
|
|
|
2022-10-06 01:15:23 +10:00
|
|
|
if(!furi_string_cmp(args, "0")) {
|
2022-11-12 17:46:04 +09:00
|
|
|
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
|
|
|
|
|
notification_message_block(notification, &sequence_reset_vibro);
|
|
|
|
|
furi_record_close(RECORD_NOTIFICATION);
|
2022-10-06 01:15:23 +10:00
|
|
|
} else if(!furi_string_cmp(args, "1")) {
|
2024-10-17 22:57:10 +07:00
|
|
|
if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagStealthMode)) {
|
|
|
|
|
printf("Flipper is in stealth mode. Unmute the device to control vibration.");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-12 17:46:04 +09:00
|
|
|
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
|
2024-10-17 22:57:10 +07:00
|
|
|
if(notification->settings.vibro_on) {
|
|
|
|
|
notification_message_block(notification, &sequence_set_vibro_on);
|
|
|
|
|
} else {
|
|
|
|
|
printf("Vibro is disabled in settings. Enable it to control vibration.");
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-12 17:46:04 +09:00
|
|
|
furi_record_close(RECORD_NOTIFICATION);
|
2022-03-17 04:49:36 -05:00
|
|
|
} else {
|
2022-11-12 17:46:04 +09:00
|
|
|
cli_print_usage("vibro", "<1|0>", furi_string_get_cstr(args));
|
2022-03-17 04:49:36 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
void cli_command_led(PipeSide* pipe, FuriString* args, void* context) {
|
|
|
|
|
UNUSED(pipe);
|
2022-05-06 16:37:10 +03:00
|
|
|
UNUSED(context);
|
2021-03-08 18:48:14 +03:00
|
|
|
// Get first word as light name
|
2021-05-24 23:44:14 +10:00
|
|
|
NotificationMessage notification_led_message;
|
2022-10-06 01:15:23 +10:00
|
|
|
FuriString* light_name;
|
|
|
|
|
light_name = furi_string_alloc();
|
|
|
|
|
size_t ws = furi_string_search_char(args, ' ');
|
|
|
|
|
if(ws == FURI_STRING_FAILURE) {
|
|
|
|
|
cli_print_usage("led", "<r|g|b|bl> <0-255>", furi_string_get_cstr(args));
|
|
|
|
|
furi_string_free(light_name);
|
2021-03-08 18:48:14 +03:00
|
|
|
return;
|
|
|
|
|
} else {
|
2022-10-06 01:15:23 +10:00
|
|
|
furi_string_set_n(light_name, args, 0, ws);
|
|
|
|
|
furi_string_right(args, ws);
|
|
|
|
|
furi_string_trim(args);
|
2021-03-08 18:48:14 +03:00
|
|
|
}
|
|
|
|
|
// Check light name
|
2022-10-06 01:15:23 +10:00
|
|
|
if(!furi_string_cmp(light_name, "r")) {
|
2021-05-24 23:44:14 +10:00
|
|
|
notification_led_message.type = NotificationMessageTypeLedRed;
|
2022-10-06 01:15:23 +10:00
|
|
|
} else if(!furi_string_cmp(light_name, "g")) {
|
2021-05-24 23:44:14 +10:00
|
|
|
notification_led_message.type = NotificationMessageTypeLedGreen;
|
2022-10-06 01:15:23 +10:00
|
|
|
} else if(!furi_string_cmp(light_name, "b")) {
|
2021-05-24 23:44:14 +10:00
|
|
|
notification_led_message.type = NotificationMessageTypeLedBlue;
|
2022-10-06 01:15:23 +10:00
|
|
|
} else if(!furi_string_cmp(light_name, "bl")) {
|
2022-04-29 17:21:12 +03:00
|
|
|
notification_led_message.type = NotificationMessageTypeLedDisplayBacklight;
|
2021-03-08 18:48:14 +03:00
|
|
|
} else {
|
2022-10-06 01:15:23 +10:00
|
|
|
cli_print_usage("led", "<r|g|b|bl> <0-255>", furi_string_get_cstr(args));
|
|
|
|
|
furi_string_free(light_name);
|
2021-03-08 18:48:14 +03:00
|
|
|
return;
|
|
|
|
|
}
|
2022-10-06 01:15:23 +10:00
|
|
|
furi_string_free(light_name);
|
2021-03-08 18:48:14 +03:00
|
|
|
// Read light value from the rest of the string
|
2024-09-05 20:02:42 +03:00
|
|
|
uint32_t value;
|
|
|
|
|
if(strint_to_uint32(furi_string_get_cstr(args), NULL, &value, 0) != StrintParseNoError ||
|
|
|
|
|
value >= 256) {
|
2022-10-06 01:15:23 +10:00
|
|
|
cli_print_usage("led", "<r|g|b|bl> <0-255>", furi_string_get_cstr(args));
|
2021-03-08 18:48:14 +03:00
|
|
|
return;
|
|
|
|
|
}
|
2021-05-24 23:44:14 +10:00
|
|
|
|
|
|
|
|
// Set led value
|
|
|
|
|
notification_led_message.data.led.value = value;
|
|
|
|
|
|
|
|
|
|
// Form notification sequence
|
|
|
|
|
const NotificationSequence notification_sequence = {
|
|
|
|
|
¬ification_led_message,
|
|
|
|
|
NULL,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Send notification
|
2022-07-26 15:21:51 +03:00
|
|
|
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
|
2021-05-24 23:44:14 +10:00
|
|
|
notification_internal_message_block(notification, ¬ification_sequence);
|
2022-07-26 15:21:51 +03:00
|
|
|
furi_record_close(RECORD_NOTIFICATION);
|
2021-03-08 18:48:14 +03:00
|
|
|
}
|
|
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
static void cli_command_top(PipeSide* pipe, FuriString* args, void* context) {
|
2022-05-06 16:37:10 +03:00
|
|
|
UNUSED(context);
|
|
|
|
|
|
2024-06-13 18:07:13 +01:00
|
|
|
int interval = 1000;
|
|
|
|
|
args_read_int_and_trim(args, &interval);
|
|
|
|
|
|
|
|
|
|
FuriThreadList* thread_list = furi_thread_list_alloc();
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
while(!cli_is_pipe_broken_or_is_etx_next_char(pipe)) {
|
2024-06-13 18:07:13 +01:00
|
|
|
uint32_t tick = furi_get_tick();
|
|
|
|
|
furi_thread_enumerate(thread_list);
|
|
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
if(interval) printf(ANSI_CURSOR_POS("1", "1"));
|
2024-06-13 18:07:13 +01:00
|
|
|
|
|
|
|
|
uint32_t uptime = tick / furi_kernel_get_tick_frequency();
|
|
|
|
|
printf(
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
"Threads: %zu, ISR Time: %0.2f%%, Uptime: %luh%lum%lus" ANSI_ERASE_LINE(
|
|
|
|
|
ANSI_ERASE_FROM_CURSOR_TO_END) "\r\n",
|
2024-06-13 18:07:13 +01:00
|
|
|
furi_thread_list_size(thread_list),
|
2024-07-06 11:44:25 +01:00
|
|
|
(double)furi_thread_list_get_isr_time(thread_list),
|
2024-06-13 18:07:13 +01:00
|
|
|
uptime / 60 / 60,
|
|
|
|
|
uptime / 60 % 60,
|
|
|
|
|
uptime % 60);
|
|
|
|
|
|
2021-04-13 09:46:35 +03:00
|
|
|
printf(
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
"Heap: total %zu, free %zu, minimum %zu, max block %zu" ANSI_ERASE_LINE(
|
|
|
|
|
ANSI_ERASE_FROM_CURSOR_TO_END) "\r\n" ANSI_ERASE_LINE(ANSI_ERASE_FROM_CURSOR_TO_END) "\r\n",
|
2024-06-13 18:07:13 +01:00
|
|
|
memmgr_get_total_heap(),
|
|
|
|
|
memmgr_get_free_heap(),
|
|
|
|
|
memmgr_get_minimum_free_heap(),
|
|
|
|
|
memmgr_heap_get_max_free_block());
|
|
|
|
|
|
|
|
|
|
printf(
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
"%-17s %-20s %-10s %5s %12s %6s %10s %7s %5s" ANSI_ERASE_LINE(
|
|
|
|
|
ANSI_ERASE_FROM_CURSOR_TO_END) "\r\n",
|
2024-06-13 18:07:13 +01:00
|
|
|
"AppID",
|
|
|
|
|
"Name",
|
|
|
|
|
"State",
|
|
|
|
|
"Prio",
|
|
|
|
|
"Stack start",
|
|
|
|
|
"Stack",
|
|
|
|
|
"Stack Min",
|
|
|
|
|
"Heap",
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
"%CPU");
|
2024-06-13 18:07:13 +01:00
|
|
|
|
|
|
|
|
for(size_t i = 0; i < furi_thread_list_size(thread_list); i++) {
|
|
|
|
|
const FuriThreadListItem* item = furi_thread_list_get_at(thread_list, i);
|
|
|
|
|
printf(
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
"%-17s %-20s %-10s %5d 0x%08lx %6lu %10lu %7zu %5.1f" ANSI_ERASE_LINE(
|
|
|
|
|
ANSI_ERASE_FROM_CURSOR_TO_END) "\r\n",
|
2024-06-13 18:07:13 +01:00
|
|
|
item->app_id,
|
|
|
|
|
item->name,
|
|
|
|
|
item->state,
|
|
|
|
|
item->priority,
|
|
|
|
|
item->stack_address,
|
|
|
|
|
item->stack_size,
|
|
|
|
|
item->stack_min_free,
|
|
|
|
|
item->heap,
|
|
|
|
|
(double)item->cpu);
|
|
|
|
|
}
|
|
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
printf(ANSI_ERASE_DISPLAY(ANSI_ERASE_FROM_CURSOR_TO_END));
|
|
|
|
|
fflush(stdout);
|
|
|
|
|
|
2024-06-13 18:07:13 +01:00
|
|
|
if(interval > 0) {
|
|
|
|
|
furi_delay_ms(interval);
|
|
|
|
|
} else {
|
|
|
|
|
break;
|
|
|
|
|
}
|
2021-04-13 09:46:35 +03:00
|
|
|
}
|
2024-06-13 18:07:13 +01:00
|
|
|
furi_thread_list_free(thread_list);
|
2021-07-05 23:01:02 +10:00
|
|
|
}
|
|
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
void cli_command_free(PipeSide* pipe, FuriString* args, void* context) {
|
|
|
|
|
UNUSED(pipe);
|
2022-05-06 16:37:10 +03:00
|
|
|
UNUSED(args);
|
|
|
|
|
UNUSED(context);
|
|
|
|
|
|
2022-12-26 15:13:30 +03:00
|
|
|
printf("Free heap size: %zu\r\n", memmgr_get_free_heap());
|
|
|
|
|
printf("Total heap size: %zu\r\n", memmgr_get_total_heap());
|
|
|
|
|
printf("Minimum heap size: %zu\r\n", memmgr_get_minimum_free_heap());
|
|
|
|
|
printf("Maximum heap block: %zu\r\n", memmgr_heap_get_max_free_block());
|
2022-08-27 14:25:47 +10:00
|
|
|
|
2024-05-16 15:43:27 +01:00
|
|
|
printf("Pool free: %zu\r\n", memmgr_pool_get_free());
|
|
|
|
|
printf("Maximum pool block: %zu\r\n", memmgr_pool_get_max_block());
|
2021-04-13 09:46:35 +03:00
|
|
|
}
|
|
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
void cli_command_free_blocks(PipeSide* pipe, FuriString* args, void* context) {
|
|
|
|
|
UNUSED(pipe);
|
2022-05-06 16:37:10 +03:00
|
|
|
UNUSED(args);
|
|
|
|
|
UNUSED(context);
|
|
|
|
|
|
2024-05-16 15:43:27 +01:00
|
|
|
memmgr_heap_printf_free_blocks();
|
[FL-1191][FL-1524] Filesystem rework (#568)
* FS-Api: removed datetime manipulation functions and most of the file flags
* Filesystem: common proxy api
* Filesystem: renamed to Storage. Work has begun on a glue layer. Added functions for reentrance.
* Storage: sd mount and sd file open
* Storage: sd file close
* Storage: temporary test app
* Storage: free filedata on close
* Storage: sd file read and write
* Storage: added internal storage (LittleFS)
* Storage: renamed internal commands
* Storage: seek, tell, truncate, size, sync, eof
* Storage: error descriptions
* Storage: directory management api (open, close, read, rewind)
* Storage: common management api (stat, fs_stat, remove, rename, mkdir)
* Dolphin app and Notifications app now use raw storage.
* Storage: storage statuses renamed. Implemented sd card icon.
* Storage: added raw sd-card api.
* Storage settings: work started
* Assets: use new icons approach
* Storage settings: working storage settings
* Storage: completely redesigned api, no longer sticking out FS_Api
* Storage: more simplified api, getting error_id from file is hidden from user, pointer to api is hidden inside file
* Storage: cli info and format commands
* Storage-cli: file list
* Storage: a simpler and more reliable api
* FatFS: slightly lighter and faster config. Also disabled reentrancy and file locking functions. They moved to a storage service.
* Storage-cli: accommodate to the new cli api.
* Storage: filesystem api is separated into internal and common api.
* Cli: added the ability to print the list of free heap blocks
* Storage: uses a list instead of an array to store the StorageFile. Rewrote api calls to use semaphores instead of thread flags.
* Storage settings: added the ability to benchmark the SD card.
* Gui module file select: uses new storage api
* Apps: removed deprecated sd_card_test application
* Args lib: support for enquoted arguments
* Dialogs: a new gui app for simple non-asynchronous apps
* Dialogs: view holder for easy single view work
* File worker: use new storage api
* IButton and lfrrfid apps: save keys to any storage
* Apps: fix ibutton and lfrfid stack, remove sd_card_test.
* SD filesystem: app removed
* File worker: fixed api pointer type
* Subghz: loading assets using the new storage api
* NFC: use the new storage api
* Dialogs: the better api for the message element
* Archive: use new storage api
* Irda: changed assest path, changed app path
* FileWorker: removed unused file_buf_cnt
* Storage: copying and renaming files now works between storages
* Storage cli: read, copy, remove, rename commands
* Archive: removed commented code
* Storage cli: write command
* Applications: add SRV_STORAGE and SRV_DIALOGS
* Internal-storage: removed
* Storage: improved api
* Storage app: changed api pointer from StorageApp to Storage
* Storage: better file_id handling
* Storage: more consistent errors
* Loader: support for NULL icons
* Storage: do nothing with the lfs file or directory if it is not open
* Storage: fix typo
* Storage: minor float usage cleanup, rename some symbols.
* Storage: compact doxygen comments.
Co-authored-by: あく <alleteam@gmail.com>
2021-07-23 22:20:19 +10:00
|
|
|
}
|
|
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
void cli_command_i2c(PipeSide* pipe, FuriString* args, void* context) {
|
|
|
|
|
UNUSED(pipe);
|
2022-05-06 16:37:10 +03:00
|
|
|
UNUSED(args);
|
|
|
|
|
UNUSED(context);
|
|
|
|
|
|
2021-12-02 02:21:57 +03:00
|
|
|
furi_hal_i2c_acquire(&furi_hal_i2c_handle_external);
|
|
|
|
|
printf("Scanning external i2c on PC0(SCL)/PC1(SDA)\r\n"
|
|
|
|
|
"Clock: 100khz, 7bit address\r\n"
|
2021-12-02 15:19:47 +04:00
|
|
|
"\r\n");
|
2021-12-02 02:21:57 +03:00
|
|
|
printf(" | 0 1 2 3 4 5 6 7 8 9 A B C D E F\r\n");
|
|
|
|
|
printf("--+--------------------------------\r\n");
|
|
|
|
|
for(uint8_t row = 0; row < 0x8; row++) {
|
|
|
|
|
printf("%x | ", row);
|
|
|
|
|
for(uint8_t column = 0; column <= 0xF; column++) {
|
2022-01-12 18:29:28 +03:00
|
|
|
bool ret = furi_hal_i2c_is_device_ready(
|
|
|
|
|
&furi_hal_i2c_handle_external, ((row << 4) + column) << 1, 2);
|
2021-12-02 02:21:57 +03:00
|
|
|
printf("%c ", ret ? '#' : '-');
|
|
|
|
|
}
|
|
|
|
|
printf("\r\n");
|
|
|
|
|
}
|
|
|
|
|
furi_hal_i2c_release(&furi_hal_i2c_handle_external);
|
|
|
|
|
}
|
|
|
|
|
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
/**
|
|
|
|
|
* Echoes any bytes it receives except ASCII ETX (0x03, Ctrl+C)
|
|
|
|
|
*/
|
|
|
|
|
void cli_command_echo(PipeSide* pipe, FuriString* args, void* context) {
|
|
|
|
|
UNUSED(args);
|
|
|
|
|
UNUSED(context);
|
|
|
|
|
|
|
|
|
|
uint8_t buffer[256];
|
|
|
|
|
|
|
|
|
|
while(true) {
|
|
|
|
|
size_t to_read = CLAMP(pipe_bytes_available(pipe), sizeof(buffer), 1UL);
|
|
|
|
|
size_t read = pipe_receive(pipe, buffer, to_read);
|
|
|
|
|
if(read < to_read) break;
|
|
|
|
|
|
|
|
|
|
if(memchr(buffer, CliKeyETX, read)) break;
|
|
|
|
|
|
|
|
|
|
size_t written = pipe_send(pipe, buffer, read);
|
|
|
|
|
if(written < read) break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-16 13:16:34 +03:00
|
|
|
void cli_commands_init(Cli* cli) {
|
2023-02-26 14:28:52 +02:00
|
|
|
cli_add_command(cli, "!", CliCommandFlagParallelSafe, cli_command_info, (void*)true);
|
|
|
|
|
cli_add_command(cli, "info", CliCommandFlagParallelSafe, cli_command_info, NULL);
|
|
|
|
|
cli_add_command(cli, "device_info", CliCommandFlagParallelSafe, cli_command_info, (void*)true);
|
2021-07-02 03:58:31 +03:00
|
|
|
|
2021-07-18 21:09:00 +03:00
|
|
|
cli_add_command(cli, "?", CliCommandFlagParallelSafe, cli_command_help, NULL);
|
|
|
|
|
cli_add_command(cli, "help", CliCommandFlagParallelSafe, cli_command_help, NULL);
|
2021-07-02 03:58:31 +03:00
|
|
|
|
2023-07-13 15:02:08 +04:00
|
|
|
cli_add_command(cli, "uptime", CliCommandFlagDefault, cli_command_uptime, NULL);
|
2021-07-18 21:09:00 +03:00
|
|
|
cli_add_command(cli, "date", CliCommandFlagParallelSafe, cli_command_date, NULL);
|
|
|
|
|
cli_add_command(cli, "log", CliCommandFlagParallelSafe, cli_command_log, NULL);
|
2022-11-12 17:46:04 +09:00
|
|
|
cli_add_command(cli, "sysctl", CliCommandFlagDefault, cli_command_sysctl, NULL);
|
2024-06-13 18:07:13 +01:00
|
|
|
cli_add_command(cli, "top", CliCommandFlagParallelSafe, cli_command_top, NULL);
|
2021-07-18 21:09:00 +03:00
|
|
|
cli_add_command(cli, "free", CliCommandFlagParallelSafe, cli_command_free, NULL);
|
[FL-1191][FL-1524] Filesystem rework (#568)
* FS-Api: removed datetime manipulation functions and most of the file flags
* Filesystem: common proxy api
* Filesystem: renamed to Storage. Work has begun on a glue layer. Added functions for reentrance.
* Storage: sd mount and sd file open
* Storage: sd file close
* Storage: temporary test app
* Storage: free filedata on close
* Storage: sd file read and write
* Storage: added internal storage (LittleFS)
* Storage: renamed internal commands
* Storage: seek, tell, truncate, size, sync, eof
* Storage: error descriptions
* Storage: directory management api (open, close, read, rewind)
* Storage: common management api (stat, fs_stat, remove, rename, mkdir)
* Dolphin app and Notifications app now use raw storage.
* Storage: storage statuses renamed. Implemented sd card icon.
* Storage: added raw sd-card api.
* Storage settings: work started
* Assets: use new icons approach
* Storage settings: working storage settings
* Storage: completely redesigned api, no longer sticking out FS_Api
* Storage: more simplified api, getting error_id from file is hidden from user, pointer to api is hidden inside file
* Storage: cli info and format commands
* Storage-cli: file list
* Storage: a simpler and more reliable api
* FatFS: slightly lighter and faster config. Also disabled reentrancy and file locking functions. They moved to a storage service.
* Storage-cli: accommodate to the new cli api.
* Storage: filesystem api is separated into internal and common api.
* Cli: added the ability to print the list of free heap blocks
* Storage: uses a list instead of an array to store the StorageFile. Rewrote api calls to use semaphores instead of thread flags.
* Storage settings: added the ability to benchmark the SD card.
* Gui module file select: uses new storage api
* Apps: removed deprecated sd_card_test application
* Args lib: support for enquoted arguments
* Dialogs: a new gui app for simple non-asynchronous apps
* Dialogs: view holder for easy single view work
* File worker: use new storage api
* IButton and lfrrfid apps: save keys to any storage
* Apps: fix ibutton and lfrfid stack, remove sd_card_test.
* SD filesystem: app removed
* File worker: fixed api pointer type
* Subghz: loading assets using the new storage api
* NFC: use the new storage api
* Dialogs: the better api for the message element
* Archive: use new storage api
* Irda: changed assest path, changed app path
* FileWorker: removed unused file_buf_cnt
* Storage: copying and renaming files now works between storages
* Storage cli: read, copy, remove, rename commands
* Archive: removed commented code
* Storage cli: write command
* Applications: add SRV_STORAGE and SRV_DIALOGS
* Internal-storage: removed
* Storage: improved api
* Storage app: changed api pointer from StorageApp to Storage
* Storage: better file_id handling
* Storage: more consistent errors
* Loader: support for NULL icons
* Storage: do nothing with the lfs file or directory if it is not open
* Storage: fix typo
* Storage: minor float usage cleanup, rename some symbols.
* Storage: compact doxygen comments.
Co-authored-by: あく <alleteam@gmail.com>
2021-07-23 22:20:19 +10:00
|
|
|
cli_add_command(cli, "free_blocks", CliCommandFlagParallelSafe, cli_command_free_blocks, NULL);
|
[FL-3954, FL-3955] New CLI architecture (#4111)
* feat: FuriThread stdin
* ci: fix f18
* feat: stdio callback context
* feat: FuriPipe
* POTENTIALLY EXPLOSIVE pipe welding
* fix: non-explosive welding
* Revert welding
* docs: furi_pipe
* feat: pipe event loop integration
* update f18 sdk
* f18
* docs: make doxygen happy
* fix: event loop not triggering when pipe attached to stdio
* fix: partial stdout in pipe
* allow simultaneous in and out subscription in event loop
* feat: vcp i/o
* feat: cli ansi stuffs and history
* feat: more line editing
* working but slow cli rewrite
* restore previous speed after 4 days of debugging 🥲
* fix: cli_app_should_stop
* fix: cli and event_loop memory leaks
* style: remove commented out code
* ci: fix pvs warnings
* fix: unit tests, event_loop crash
* ci: fix build
* ci: silence pvs warning
* feat: cli gpio
* ci: fix formatting
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* feat: cli completions
* Merge remote-tracking branch 'origin/dev' into portasynthinca3/3928-cli-threads
* merge fixups
* temporarily exclude speaker_debug app
* pvs and unit tests fixups
* feat: commands in fals
* move commands out of flash, code cleanup
* ci: fix errors
* fix: run commands in buffer when stopping session
* speedup cli file transfer
* fix f18
* separate cli_shell into modules
* fix pvs warning
* fix qflipper refusing to connect
* remove temp debug logs
* remove erroneous conclusion
* Fix memory leak during event loop unsubscription
* Event better memory leak fix
* unit test for the fix
* improve thread stdio callback signatures
* pipe stdout timeout
* update api symbols
* fix f18, formatting
* fix pvs warnings
* increase stack size, hope to fix unit tests
* cli: revert flag changes
* cli: fix formatting
* cli, fbt: loopback perf benchmark
* thread, event_loop: subscribing to thread flags
* cli: signal internal events using thread flags, improve performance
* fix f18, formatting
* event_loop: fix crash
* storage_cli: increase write_chunk buffer size again
* cli: explanation for order=0
* thread, event_loop: thread flags callback refactor
* cli: increase stack size
* cli: rename cli_app_should_stop -> cli_is_pipe_broken_or_is_etx_next_char
* cli: use plain array instead of mlib for history
* cli: prepend file name to static fns
* cli: fix formatting
* cli_shell: increase stack size
* cli: fix rpc lockup
* cli: better lockup fix
* cli: fix f18
* fix merge
---------
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: あく <alleteam@gmail.com>
2025-04-02 22:10:10 +04:00
|
|
|
cli_add_command(cli, "echo", CliCommandFlagParallelSafe, cli_command_echo, NULL);
|
2021-07-18 21:09:00 +03:00
|
|
|
|
|
|
|
|
cli_add_command(cli, "vibro", CliCommandFlagDefault, cli_command_vibro, NULL);
|
|
|
|
|
cli_add_command(cli, "led", CliCommandFlagDefault, cli_command_led, NULL);
|
2022-06-10 00:04:36 +09:00
|
|
|
cli_add_command(cli, "gpio", CliCommandFlagDefault, cli_command_gpio, NULL);
|
2021-12-02 02:21:57 +03:00
|
|
|
cli_add_command(cli, "i2c", CliCommandFlagDefault, cli_command_i2c, NULL);
|
2022-06-09 04:53:26 -04:00
|
|
|
}
|