1# Copyright 2023 Google LLC
2# SPDX-License-Identifier: Apache-2.0
3
4description: |
5  Input longpress pseudo-device
6
7  Listens for key events as an input and produces key events as output
8  corresponding to short and long press.
9
10  Can be optionally be associated to a specific device to listen for events
11  only from that device.
12
13  Example configuration:
14
15  #include <zephyr/dt-bindings/input/input-event-codes.h>
16
17  longpress {
18          input = <&buttons>;
19          compatible = "zephyr,input-longpress";
20          input-codes = <INPUT_KEY_0>, <INPUT_KEY_1>;
21          short-codes = <INPUT_KEY_A>, <INPUT_KEY_B>;
22          long-codes = <INPUT_KEY_X>, <INPUT_KEY_Y>;
23          long-delay-ms = <1000>;
24  };
25
26  Example output:
27
28  # short press
29  input event: dev=buttons          SYN type= 1 code= 11 value=1 # INPUT_KEY_0 press
30  # release before one second
31  input event: dev=buttons          SYN type= 1 code= 11 value=0 # INPUT_KEY_0 release
32  input event: dev=longpress        SYN type= 1 code= 30 value=1 # INPUT_KEY_A press
33  input event: dev=longpress        SYN type= 1 code= 30 value=0 # INPUT_KEY_A release
34
35  # long press
36  input event: dev=buttons          SYN type= 1 code= 11 value=1 # INPUT_KEY_0 press
37  # hold for more than one second
38  input event: dev=longpress        SYN type= 1 code= 45 value=1 # INPUT_KEY_X press
39  # wait for release
40  input event: dev=buttons          SYN type= 1 code= 11 value=0 # INPUT_KEY_0 release
41  input event: dev=longpress        SYN type= 1 code= 45 value=0 # INPUT_KEY_X release
42
43compatible: "zephyr,input-longpress"
44
45properties:
46  input:
47    type: phandle
48    description: |
49      Input device phandle, if not specified listen for input from all devices.
50
51  input-codes:
52    type: array
53    required: true
54    description: |
55      Array of input event key codes (INPUT_KEY_* or INPUT_BTN_*).
56
57  short-codes:
58    type: array
59    description: |
60      Optional array of key codes to be generated for short press (INPUT_KEY_* or
61      INPUT_BTN_*).
62
63  long-codes:
64    type: array
65    required: true
66    description: |
67      Array of key codes to be generated for long press (INPUT_KEY_* or
68      INPUT_BTN_*).
69
70  long-delay-ms:
71    type: int
72    required: true
73    description: Time delay to register a long press in milliseconds.
74