Hi everyone,
I’m working with a Zephyr input overlay where I define double-tap, longpress, and extra_longpress behaviors on the same physical button.
This is the overlay I’m using:
/ {
aliases {
we13rfsmdoubletap = &double_tap;
we13rfsmlongpress = &longpress;
we13rfsmextralongpress = &extra_longpress;
};
double_tap: double_tap {
input = <&{/buttons}>;
compatible = "zephyr,input-double-tap";
input-codes = <INPUT_KEY_0>;
double-tap-codes = <INPUT_BTN_8>;
double-tap-delay-ms = <300>;
};
longpress: longpress {
input = <&{/buttons}>;
compatible = "zephyr,input-longpress";
input-codes = <INPUT_KEY_0>;
short-codes = <INPUT_BTN_0>;
long-codes = <INPUT_BTN_2>;
long-delay-ms = <1000>;
};
extra_longpress: extra_longpress {
input = <&buttons>;
compatible = "zephyr,input-longpress";
input-codes = <INPUT_BTN_2>;
short-codes = <INPUT_BTN_2>;
long-codes = <INPUT_BTN_6>;
long-delay-ms = <2000>;
};
};
Issue:
I have a state machine that receives button events from the input subsystem.
When I perform an extra long press, the state machine receives both:
INPUT_BTN_2/ long press eventINPUT_BTN_6/ extra long press event
Similarly, when I perform a double tap, the state machine receives both:
INPUT_BTN_0/ short press eventINPUT_BTN_8/ double tap event
Expected behavior:
I would like the state machine to receive only the final interpreted gesture event.
For example:
- Extra long press → only
INPUT_BTN_6 - Double tap → only
INPUT_BTN_8 - Long press → only
INPUT_BTN_2 - Short press → only
INPUT_BTN_0
Question:
Is there any way to fix this behaviour?
Thanks in advance for your help!