diff --git a/applications/services/input/input.c b/applications/services/input/input.c index bcbee0d56..5f5872504 100644 --- a/applications/services/input/input.c +++ b/applications/services/input/input.c @@ -54,23 +54,6 @@ const char* input_get_type_name(InputType type) { } } -void input_fake_event(Input* input, InputKey key, InputType type) { - bool wrap = type == InputTypeShort || type == InputTypeLong; - InputEvent event; - event.key = key; - - if(wrap) { - event.type = InputTypePress; - furi_pubsub_publish(input->event_pubsub, &event); - } - event.type = type; - furi_pubsub_publish(input->event_pubsub, &event); - if(wrap) { - event.type = InputTypeRelease; - furi_pubsub_publish(input->event_pubsub, &event); - } -} - int32_t input_srv(void* p) { UNUSED(p); input = malloc(sizeof(Input)); diff --git a/applications/services/input/input_cli.c b/applications/services/input/input_cli.c index 5f5c233e6..f090060b5 100644 --- a/applications/services/input/input_cli.c +++ b/applications/services/input/input_cli.c @@ -41,6 +41,23 @@ static void input_cli_dump(Cli* cli, FuriString* args, Input* input) { furi_message_queue_free(input_queue); } +static void fake_input(Input* input, InputKey key, InputType type) { + bool wrap = type == InputTypeShort || type == InputTypeLong; + InputEvent event; + event.key = key; + + if(wrap) { + event.type = InputTypePress; + furi_pubsub_publish(input->event_pubsub, &event); + } + event.type = type; + furi_pubsub_publish(input->event_pubsub, &event); + if(wrap) { + event.type = InputTypeRelease; + furi_pubsub_publish(input->event_pubsub, &event); + } +} + static void input_cli_keyboard(Cli* cli, FuriString* args, Input* input) { UNUSED(args); FuriPubSub* ascii_events = furi_record_open(RECORD_ASCII_EVENTS); @@ -108,7 +125,7 @@ static void input_cli_keyboard(Cli* cli, FuriString* args, Input* input) { } if(send_key != InputKeyMAX) { - input_fake_event(input, send_key, hold ? InputTypeLong : InputTypeShort); + fake_input(input, send_key, hold ? InputTypeLong : InputTypeShort); hold = false; } if(send_ascii != AsciiValueNUL) { @@ -172,7 +189,7 @@ static void input_cli_send(Cli* cli, FuriString* args, Input* input) { } while(false); if(parsed) { //-V547 - input_fake_event(input, key, type); + fake_input(input, key, type); } else { input_cli_send_print_usage(); } diff --git a/applications/services/input/input_i.h b/applications/services/input/input_i.h index 206f9f2d0..433e0da92 100644 --- a/applications/services/input/input_i.h +++ b/applications/services/input/input_i.h @@ -48,5 +48,3 @@ void input_isr(void* _ctx); /** Input CLI command handler */ void input_cli(Cli* cli, FuriString* args, void* context); - -void input_fake_event(Input* input, InputKey key, InputType type);