diff --git a/applications/services/input/input.c b/applications/services/input/input.c index 8da0a3400..9ea1e6b5b 100644 --- a/applications/services/input/input.c +++ b/applications/services/input/input.c @@ -68,6 +68,23 @@ 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_i.h b/applications/services/input/input_i.h index 14d8b0735..e5a5b7539 100644 --- a/applications/services/input/input_i.h +++ b/applications/services/input/input_i.h @@ -46,3 +46,5 @@ 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);