2022-03-29 23:01:56 +10:00
|
|
|
#include <furi.h>
|
|
|
|
|
#include <furi_hal.h>
|
2023-03-02 16:23: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
|
|
|
#include <cli/cli_commands.h>
|
2023-03-02 16:23:33 +03:00
|
|
|
#include <toolbox/args.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>
|
2023-03-02 16:23:33 +03:00
|
|
|
|
2023-03-20 19:23:17 +03:00
|
|
|
#include <ibutton/ibutton_key.h>
|
|
|
|
|
#include <ibutton/ibutton_worker.h>
|
|
|
|
|
#include <ibutton/ibutton_protocols.h>
|
2023-03-02 16:23:33 +03:00
|
|
|
|
2024-03-19 23:43:52 +09:00
|
|
|
static void ibutton_cli_print_usage(void) {
|
2022-03-29 23:01:56 +10:00
|
|
|
printf("Usage:\r\n");
|
|
|
|
|
printf("ikey read\r\n");
|
|
|
|
|
printf("ikey emulate <key_type> <key_data>\r\n");
|
|
|
|
|
printf("ikey write Dallas <key_data>\r\n");
|
|
|
|
|
printf("\t<key_type> choose from:\r\n");
|
|
|
|
|
printf("\tDallas (8 bytes key_data)\r\n");
|
|
|
|
|
printf("\tCyfral (2 bytes key_data)\r\n");
|
2022-03-30 21:54:29 +10:00
|
|
|
printf("\tMetakom (4 bytes key_data), must contain correct parity\r\n");
|
2022-03-29 23:01:56 +10:00
|
|
|
printf("\t<key_data> are hex-formatted\r\n");
|
2024-07-15 07:38:49 +03:00
|
|
|
}
|
2022-03-29 23:01:56 +10:00
|
|
|
|
2023-03-02 16:23:33 +03:00
|
|
|
static bool ibutton_cli_parse_key(iButtonProtocols* protocols, iButtonKey* key, FuriString* args) {
|
2022-03-29 23:01:56 +10:00
|
|
|
bool result = false;
|
2023-03-02 16:23:33 +03:00
|
|
|
FuriString* name = furi_string_alloc();
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
// Read protocol name
|
|
|
|
|
if(!args_read_string_and_trim(args, name)) break;
|
|
|
|
|
|
|
|
|
|
// Make the protocol name uppercase
|
|
|
|
|
const char first = furi_string_get_char(name, 0);
|
|
|
|
|
furi_string_set_char(name, 0, toupper((int)first));
|
|
|
|
|
|
|
|
|
|
const iButtonProtocolId id =
|
|
|
|
|
ibutton_protocols_get_id_by_name(protocols, furi_string_get_cstr(name));
|
|
|
|
|
if(id == iButtonProtocolIdInvalid) break;
|
|
|
|
|
|
|
|
|
|
ibutton_key_set_protocol_id(key, id);
|
|
|
|
|
|
|
|
|
|
// Get the data pointer
|
|
|
|
|
iButtonEditableData data;
|
|
|
|
|
ibutton_protocols_get_editable_data(protocols, key, &data);
|
|
|
|
|
|
|
|
|
|
// Read data
|
|
|
|
|
if(!args_read_hex_bytes(args, data.ptr, data.size)) break;
|
2022-03-29 23:01:56 +10:00
|
|
|
|
|
|
|
|
result = true;
|
2023-03-02 16:23:33 +03:00
|
|
|
} while(false);
|
2022-03-29 23:01:56 +10:00
|
|
|
|
2023-03-02 16:23:33 +03:00
|
|
|
furi_string_free(name);
|
2022-03-29 23:01:56 +10:00
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-02 16:23:33 +03:00
|
|
|
static void ibutton_cli_print_key(iButtonProtocols* protocols, iButtonKey* key) {
|
|
|
|
|
const char* name = ibutton_protocols_get_name(protocols, ibutton_key_get_protocol_id(key));
|
2022-03-29 23:01:56 +10:00
|
|
|
|
2023-03-02 16:23:33 +03:00
|
|
|
if(strncmp(name, "DS", 2) == 0) {
|
|
|
|
|
name = "Dallas";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("%s ", name);
|
|
|
|
|
|
|
|
|
|
iButtonEditableData data;
|
|
|
|
|
ibutton_protocols_get_editable_data(protocols, key, &data);
|
|
|
|
|
|
|
|
|
|
for(size_t i = 0; i < data.size; i++) {
|
|
|
|
|
printf("%02X", data.ptr[i]);
|
2022-03-29 23:01:56 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("\r\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#define EVENT_FLAG_IBUTTON_COMPLETE (1 << 0)
|
|
|
|
|
|
|
|
|
|
static void ibutton_cli_worker_read_cb(void* context) {
|
2022-04-01 22:21:31 +10:00
|
|
|
furi_assert(context);
|
2022-07-20 13:56:33 +03:00
|
|
|
FuriEventFlag* event = context;
|
|
|
|
|
furi_event_flag_set(event, EVENT_FLAG_IBUTTON_COMPLETE);
|
2022-03-29 23:01:56 +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
|
|
|
static void ibutton_cli_read(PipeSide* pipe) {
|
2023-03-02 16:23:33 +03:00
|
|
|
iButtonProtocols* protocols = ibutton_protocols_alloc();
|
|
|
|
|
iButtonWorker* worker = ibutton_worker_alloc(protocols);
|
|
|
|
|
iButtonKey* key = ibutton_key_alloc(ibutton_protocols_get_max_data_size(protocols));
|
2022-07-20 13:56:33 +03:00
|
|
|
FuriEventFlag* event = furi_event_flag_alloc();
|
2022-03-29 23:01:56 +10:00
|
|
|
|
|
|
|
|
ibutton_worker_start_thread(worker);
|
|
|
|
|
ibutton_worker_read_set_callback(worker, ibutton_cli_worker_read_cb, event);
|
|
|
|
|
|
2022-03-30 21:54:29 +10:00
|
|
|
printf("Reading iButton...\r\nPress Ctrl+C to abort\r\n");
|
2022-03-29 23:01:56 +10:00
|
|
|
ibutton_worker_read_start(worker, key);
|
2023-03-02 16:23:33 +03:00
|
|
|
|
2022-03-29 23:01:56 +10:00
|
|
|
while(true) {
|
2022-07-20 13:56:33 +03:00
|
|
|
uint32_t flags =
|
|
|
|
|
furi_event_flag_wait(event, EVENT_FLAG_IBUTTON_COMPLETE, FuriFlagWaitAny, 100);
|
2022-03-29 23:01:56 +10:00
|
|
|
|
|
|
|
|
if(flags & EVENT_FLAG_IBUTTON_COMPLETE) {
|
2023-03-02 16:23:33 +03:00
|
|
|
ibutton_cli_print_key(protocols, key);
|
2022-03-29 23:01:56 +10:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
[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(cli_is_pipe_broken_or_is_etx_next_char(pipe)) break;
|
2022-03-29 23:01:56 +10:00
|
|
|
}
|
|
|
|
|
|
2023-03-02 16:23:33 +03:00
|
|
|
ibutton_worker_stop(worker);
|
2022-03-29 23:01:56 +10:00
|
|
|
ibutton_worker_stop_thread(worker);
|
2023-03-02 16:23:33 +03:00
|
|
|
|
2022-03-29 23:01:56 +10:00
|
|
|
ibutton_key_free(key);
|
2023-03-02 16:23:33 +03:00
|
|
|
ibutton_worker_free(worker);
|
|
|
|
|
ibutton_protocols_free(protocols);
|
2022-03-29 23:01:56 +10:00
|
|
|
|
2022-07-20 13:56:33 +03:00
|
|
|
furi_event_flag_free(event);
|
2024-07-15 07:38:49 +03:00
|
|
|
}
|
2022-03-29 23:01:56 +10:00
|
|
|
|
|
|
|
|
typedef struct {
|
2022-07-20 13:56:33 +03:00
|
|
|
FuriEventFlag* event;
|
2022-03-29 23:01:56 +10:00
|
|
|
iButtonWorkerWriteResult result;
|
|
|
|
|
} iButtonWriteContext;
|
|
|
|
|
|
|
|
|
|
static void ibutton_cli_worker_write_cb(void* context, iButtonWorkerWriteResult result) {
|
2022-04-01 22:21:31 +10:00
|
|
|
furi_assert(context);
|
2022-03-29 23:01:56 +10:00
|
|
|
iButtonWriteContext* write_context = (iButtonWriteContext*)context;
|
|
|
|
|
write_context->result = result;
|
2022-07-20 13:56:33 +03:00
|
|
|
furi_event_flag_set(write_context->event, EVENT_FLAG_IBUTTON_COMPLETE);
|
2022-03-29 23:01:56 +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 ibutton_cli_write(PipeSide* pipe, FuriString* args) {
|
2023-03-02 16:23:33 +03:00
|
|
|
iButtonProtocols* protocols = ibutton_protocols_alloc();
|
|
|
|
|
iButtonWorker* worker = ibutton_worker_alloc(protocols);
|
|
|
|
|
iButtonKey* key = ibutton_key_alloc(ibutton_protocols_get_max_data_size(protocols));
|
2022-03-29 23:01:56 +10:00
|
|
|
|
2023-03-02 16:23:33 +03:00
|
|
|
iButtonWriteContext write_context;
|
2022-07-20 13:56:33 +03:00
|
|
|
write_context.event = furi_event_flag_alloc();
|
2022-03-29 23:01:56 +10:00
|
|
|
|
|
|
|
|
ibutton_worker_start_thread(worker);
|
|
|
|
|
ibutton_worker_write_set_callback(worker, ibutton_cli_worker_write_cb, &write_context);
|
|
|
|
|
|
|
|
|
|
do {
|
2023-03-02 16:23:33 +03:00
|
|
|
if(!ibutton_cli_parse_key(protocols, key, args)) {
|
2022-03-29 23:01:56 +10:00
|
|
|
ibutton_cli_print_usage();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-02 16:23:33 +03:00
|
|
|
if(!(ibutton_protocols_get_features(protocols, ibutton_key_get_protocol_id(key)) &
|
2024-08-01 01:59:41 +09:00
|
|
|
iButtonProtocolFeatureWriteId)) {
|
2022-03-29 23:01:56 +10:00
|
|
|
ibutton_cli_print_usage();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("Writing key ");
|
2023-03-02 16:23:33 +03:00
|
|
|
ibutton_cli_print_key(protocols, key);
|
2022-03-29 23:01:56 +10:00
|
|
|
printf("Press Ctrl+C to abort\r\n");
|
|
|
|
|
|
2024-08-01 01:59:41 +09:00
|
|
|
ibutton_worker_write_id_start(worker, key);
|
2022-03-29 23:01:56 +10:00
|
|
|
while(true) {
|
2022-07-20 13:56:33 +03:00
|
|
|
uint32_t flags = furi_event_flag_wait(
|
|
|
|
|
write_context.event, EVENT_FLAG_IBUTTON_COMPLETE, FuriFlagWaitAny, 100);
|
2022-03-29 23:01:56 +10:00
|
|
|
|
|
|
|
|
if(flags & EVENT_FLAG_IBUTTON_COMPLETE) {
|
|
|
|
|
if(write_context.result == iButtonWorkerWriteSameKey ||
|
|
|
|
|
write_context.result == iButtonWorkerWriteOK) {
|
|
|
|
|
printf("Write success\r\n");
|
|
|
|
|
break;
|
|
|
|
|
} else if(write_context.result == iButtonWorkerWriteCannotWrite) {
|
|
|
|
|
printf("Write fail\r\n");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
[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(cli_is_pipe_broken_or_is_etx_next_char(pipe)) break;
|
2022-03-29 23:01:56 +10:00
|
|
|
}
|
|
|
|
|
} while(false);
|
|
|
|
|
|
2023-03-02 16:23:33 +03:00
|
|
|
ibutton_worker_stop(worker);
|
2022-03-29 23:01:56 +10:00
|
|
|
ibutton_worker_stop_thread(worker);
|
2023-03-02 16:23:33 +03:00
|
|
|
|
2022-03-29 23:01:56 +10:00
|
|
|
ibutton_key_free(key);
|
2023-03-02 16:23:33 +03:00
|
|
|
ibutton_worker_free(worker);
|
|
|
|
|
ibutton_protocols_free(protocols);
|
2022-03-29 23:01:56 +10:00
|
|
|
|
2022-07-20 13:56:33 +03:00
|
|
|
furi_event_flag_free(write_context.event);
|
2023-03-02 16:23:33 +03:00
|
|
|
}
|
2022-03-29 23:01:56 +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 ibutton_cli_emulate(PipeSide* pipe, FuriString* args) {
|
2023-03-02 16:23:33 +03:00
|
|
|
iButtonProtocols* protocols = ibutton_protocols_alloc();
|
|
|
|
|
iButtonWorker* worker = ibutton_worker_alloc(protocols);
|
|
|
|
|
iButtonKey* key = ibutton_key_alloc(ibutton_protocols_get_max_data_size(protocols));
|
2022-03-29 23:01:56 +10:00
|
|
|
|
|
|
|
|
ibutton_worker_start_thread(worker);
|
|
|
|
|
|
|
|
|
|
do {
|
2023-03-02 16:23:33 +03:00
|
|
|
if(!ibutton_cli_parse_key(protocols, key, args)) {
|
2022-03-29 23:01:56 +10:00
|
|
|
ibutton_cli_print_usage();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("Emulating key ");
|
2023-03-02 16:23:33 +03:00
|
|
|
ibutton_cli_print_key(protocols, key);
|
2022-03-29 23:01:56 +10:00
|
|
|
printf("Press Ctrl+C to abort\r\n");
|
|
|
|
|
|
|
|
|
|
ibutton_worker_emulate_start(worker, key);
|
2023-03-02 16:23: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
|
|
|
while(!cli_is_pipe_broken_or_is_etx_next_char(pipe)) {
|
2022-07-20 13:56:33 +03:00
|
|
|
furi_delay_ms(100);
|
2022-03-29 23:01:56 +10:00
|
|
|
};
|
2023-03-02 16:23:33 +03:00
|
|
|
|
2022-03-29 23:01:56 +10:00
|
|
|
} while(false);
|
|
|
|
|
|
2023-03-02 16:23:33 +03:00
|
|
|
ibutton_worker_stop(worker);
|
2022-03-29 23:01:56 +10:00
|
|
|
ibutton_worker_stop_thread(worker);
|
2023-03-02 16:23:33 +03:00
|
|
|
|
2022-03-29 23:01:56 +10:00
|
|
|
ibutton_key_free(key);
|
2023-03-02 16:23:33 +03:00
|
|
|
ibutton_worker_free(worker);
|
|
|
|
|
ibutton_protocols_free(protocols);
|
2024-07-15 07:38:49 +03:00
|
|
|
}
|
2022-03-29 23:01:56 +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 ibutton_cli(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
|
|
|
FuriString* cmd;
|
|
|
|
|
cmd = furi_string_alloc();
|
2022-03-29 23:01:56 +10:00
|
|
|
|
|
|
|
|
if(!args_read_string_and_trim(args, cmd)) {
|
2022-10-06 01:15:23 +10:00
|
|
|
furi_string_free(cmd);
|
2022-03-29 23:01:56 +10:00
|
|
|
ibutton_cli_print_usage();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-06 01:15:23 +10:00
|
|
|
if(furi_string_cmp_str(cmd, "read") == 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
|
|
|
ibutton_cli_read(pipe);
|
2022-10-06 01:15:23 +10:00
|
|
|
} else if(furi_string_cmp_str(cmd, "write") == 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
|
|
|
ibutton_cli_write(pipe, args);
|
2022-10-06 01:15:23 +10:00
|
|
|
} else if(furi_string_cmp_str(cmd, "emulate") == 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
|
|
|
ibutton_cli_emulate(pipe, args);
|
2022-03-29 23:01:56 +10:00
|
|
|
} else {
|
|
|
|
|
ibutton_cli_print_usage();
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-06 01:15:23 +10:00
|
|
|
furi_string_free(cmd);
|
2022-03-29 23:01:56 +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 ibutton_on_system_start(void) {
|
|
|
|
|
#ifdef SRV_CLI
|
|
|
|
|
Cli* cli = furi_record_open(RECORD_CLI);
|
|
|
|
|
cli_add_command(cli, "ikey", CliCommandFlagDefault, ibutton_cli, cli);
|
|
|
|
|
furi_record_close(RECORD_CLI);
|
|
|
|
|
#else
|
|
|
|
|
UNUSED(ibutton_cli);
|
|
|
|
|
#endif
|
|
|
|
|
}
|